X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=test%2Faudio_processor_delay_test.cc;h=47a1cc8adfb344112ca01c8c22456ebbc2034599;hp=9fc2d7242cb359d6b23b32a4de9c56cc54483291;hb=6d686ea45f5cd01a0d11f92a903ac77779ad8562;hpb=5a5324ed3a381a86dfe0a6e3932c1d58fdcd596f diff --git a/test/audio_processor_delay_test.cc b/test/audio_processor_delay_test.cc index 9fc2d7242..47a1cc8ad 100644 --- a/test/audio_processor_delay_test.cc +++ b/test/audio_processor_delay_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington + Copyright (C) 2015-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,17 +18,25 @@ */ -#include "lib/audio_delay.h" + +/** @file test/audio_processor_delay_test.cc + * @brief Test the AudioDelay class. + * @ingroup selfcontained + */ + + #include "lib/audio_buffers.h" +#include "lib/audio_delay.h" #include -#include #include #include + using std::cerr; using std::cout; -using boost::shared_ptr; -using boost::make_shared; +using std::make_shared; +using std::shared_ptr; + #define CHECK_SAMPLE(c,f,r) \ if (fabs(out->data(c)[f] - (r)) > 0.1) { \ @@ -36,6 +44,7 @@ using boost::make_shared; BOOST_REQUIRE (fabs(out->data(c)[f] - (r)) <= 0.1); \ } + /** Block size greater than delay */ BOOST_AUTO_TEST_CASE (audio_processor_delay_test1) { @@ -43,14 +52,14 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test1) int const C = 2; - shared_ptr in = make_shared (C, 256); + auto in = make_shared(C, 256); for (int i = 0; i < C; ++i) { for (int j = 0; j < 256; ++j) { in->data(i)[j] = j; } } - shared_ptr out = delay.run (in); + auto out = delay.run (in); BOOST_REQUIRE_EQUAL (out->frames(), in->frames()); /* Silence at the start */ @@ -83,6 +92,7 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test1) } } + /** Block size less than delay */ BOOST_AUTO_TEST_CASE (audio_processor_delay_test2) { @@ -93,14 +103,14 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test2) /* Feeding 4 blocks of 64 should give silence each time */ for (int i = 0; i < 4; ++i) { - shared_ptr in = make_shared (C, 64); + auto in = make_shared(C, 64); for (int j = 0; j < C; ++j) { for (int k = 0; k < 64; ++k) { in->data(j)[k] = k + i * 64; } } - shared_ptr out = delay.run (in); + auto out = delay.run (in); BOOST_REQUIRE_EQUAL (out->frames(), in->frames()); /* Check for silence */ @@ -114,9 +124,9 @@ BOOST_AUTO_TEST_CASE (audio_processor_delay_test2) /* Now feed 4 blocks of silence and we should see the data */ for (int i = 0; i < 4; ++i) { /* Feed some silence */ - shared_ptr in = make_shared (C, 64); + auto in = make_shared(C, 64); in->make_silent (); - shared_ptr out = delay.run (in); + auto out = delay.run (in); /* Should now see the delayed data */ for (int j = 0; j < C; ++j) {