- merger.push (buffers, 9);
-
- TimedAudioBuffers<int> tb = merger.pull (9);
- BOOST_CHECK_EQUAL (tb.audio->frames(), 9);
- BOOST_CHECK_EQUAL (tb.time, 0);
-
- for (int i = 0; i < 9; ++i) {
- BOOST_CHECK_EQUAL (tb.audio->data()[0][i], 0);
+}
+
+/* Push two non contiguous blocks */
+BOOST_AUTO_TEST_CASE (audio_merger_test3)
+{
+ AudioMerger merger (sampling_rate);
+
+ push (merger, 0, 64, 17);
+ push (merger, 0, 64, 114);
+
+ /* Get them back */
+
+ list<pair<shared_ptr<AudioBuffers>, DCPTime> > tb = merger.pull (DCPTime::from_frames (100, sampling_rate));
+ BOOST_REQUIRE (tb.size() == 1);
+ BOOST_CHECK_EQUAL (tb.front().first->frames(), 64);
+ BOOST_CHECK_EQUAL (tb.front().second.get(), DCPTime::from_frames(17, sampling_rate).get());
+ for (int i = 0; i < 64; ++i) {
+ BOOST_CHECK_EQUAL (tb.front().first->data()[0][i], i);