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);
/* 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) {
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);