summaryrefslogtreecommitdiff
path: root/test/audio_merger_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-04 20:22:47 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-04 20:22:47 +0000
commit1b1bc528ee5ca1fee1bd33f9fb6f79cd551e3b33 (patch)
treed60b9fb573dd8d6ab89036fb8788cd1b1c69aada /test/audio_merger_test.cc
parent6d8bcba724be622739a749064466901486304cee (diff)
New DCPTime/ContentTime types.
Diffstat (limited to 'test/audio_merger_test.cc')
-rw-r--r--test/audio_merger_test.cc24
1 files changed, 10 insertions, 14 deletions
diff --git a/test/audio_merger_test.cc b/test/audio_merger_test.cc
index 31d055ab7..e8af22d2a 100644
--- a/test/audio_merger_test.cc
+++ b/test/audio_merger_test.cc
@@ -29,27 +29,22 @@ using boost::bind;
static shared_ptr<const AudioBuffers> last_audio;
-static int
-pass_through (int x)
-{
- return x;
-}
-
BOOST_AUTO_TEST_CASE (audio_merger_test1)
{
- AudioMerger<int, int> merger (1, bind (&pass_through, _1), boost::bind (&pass_through, _1));
+ int const frame_rate = 48000;
+ AudioMerger merger (1, frame_rate);
/* Push 64 samples, 0 -> 63 at time 0 */
shared_ptr<AudioBuffers> buffers (new AudioBuffers (1, 64));
for (int i = 0; i < 64; ++i) {
buffers->data()[0][i] = i;
}
- merger.push (buffers, 0);
+ merger.push (buffers, DCPTime ());
/* Push 64 samples, 0 -> 63 at time 22 */
- merger.push (buffers, 22);
+ merger.push (buffers, DCPTime::from_frames (22, frame_rate));
- TimedAudioBuffers<int> tb = merger.pull (22);
+ TimedAudioBuffers<DCPTime> tb = merger.pull (DCPTime::from_frames (22, frame_rate));
BOOST_CHECK (tb.audio != shared_ptr<const AudioBuffers> ());
BOOST_CHECK_EQUAL (tb.audio->frames(), 22);
BOOST_CHECK_EQUAL (tb.time, 0);
@@ -63,7 +58,7 @@ BOOST_AUTO_TEST_CASE (audio_merger_test1)
/* That flush should give us 64 samples at 22 */
BOOST_CHECK_EQUAL (tb.audio->frames(), 64);
- BOOST_CHECK_EQUAL (tb.time, 22);
+ BOOST_CHECK_EQUAL (tb.time, DCPTime::from_frames (22, frame_rate));
/* Check the sample values */
for (int i = 0; i < 64; ++i) {
@@ -77,16 +72,17 @@ BOOST_AUTO_TEST_CASE (audio_merger_test1)
BOOST_AUTO_TEST_CASE (audio_merger_test2)
{
- AudioMerger<int, int> merger (1, bind (&pass_through, _1), boost::bind (&pass_through, _1));
+ int const frame_rate = 48000;
+ AudioMerger merger (1, frame_rate);
/* Push 64 samples, 0 -> 63 at time 9 */
shared_ptr<AudioBuffers> buffers (new AudioBuffers (1, 64));
for (int i = 0; i < 64; ++i) {
buffers->data()[0][i] = i;
}
- merger.push (buffers, 9);
+ merger.push (buffers, DCPTime::from_frames (9, frame_rate));
- TimedAudioBuffers<int> tb = merger.pull (9);
+ TimedAudioBuffers<DCPTime> tb = merger.pull (DCPTime::from_frames (9, frame_rate));
BOOST_CHECK_EQUAL (tb.audio->frames(), 9);
BOOST_CHECK_EQUAL (tb.time, 0);