static void
push (AudioMerger& merger, int from, int to, int at)
{
static void
push (AudioMerger& merger, int from, int to, int at)
{
for (int i = 0; i < (to - from); ++i) {
buffers->data()[0][i] = from + i;
}
merger.push (buffers, DCPTime(at, sampling_rate));
}
for (int i = 0; i < (to - from); ++i) {
buffers->data()[0][i] = from + i;
}
merger.push (buffers, DCPTime(at, sampling_rate));
}
/* Basic mixing, 2 overlapping pushes */
BOOST_AUTO_TEST_CASE (audio_merger_test1)
{
/* Basic mixing, 2 overlapping pushes */
BOOST_AUTO_TEST_CASE (audio_merger_test1)
{
push (merger, 0, 64, 0);
push (merger, 0, 64, 22);
push (merger, 0, 64, 0);
push (merger, 0, 64, 22);
- list<pair<shared_ptr<AudioBuffers>, DCPTime> > tb = merger.pull (DCPTime::from_frames (22, sampling_rate));
- BOOST_REQUIRE (tb.size() == 1);
+ auto tb = merger.pull (DCPTime::from_frames (22, sampling_rate));
+ BOOST_REQUIRE (tb.size() == 1U);
BOOST_CHECK (tb.front().first != shared_ptr<const AudioBuffers> ());
BOOST_CHECK_EQUAL (tb.front().first->frames(), 22);
BOOST_CHECK_EQUAL (tb.front().second.get(), 0);
BOOST_CHECK (tb.front().first != shared_ptr<const AudioBuffers> ());
BOOST_CHECK_EQUAL (tb.front().first->frames(), 22);
BOOST_CHECK_EQUAL (tb.front().second.get(), 0);
BOOST_CHECK_EQUAL (tb.front().first->frames(), 64);
BOOST_CHECK_EQUAL (tb.front().second.get(), DCPTime::from_frames(22, sampling_rate).get());
BOOST_CHECK_EQUAL (tb.front().first->frames(), 64);
BOOST_CHECK_EQUAL (tb.front().second.get(), DCPTime::from_frames(22, sampling_rate).get());
- list<pair<shared_ptr<AudioBuffers>, DCPTime> > tb = merger.pull (DCPTime::from_frames (9, sampling_rate));
- BOOST_CHECK_EQUAL (tb.size(), 0);
+ auto tb = merger.pull (DCPTime::from_frames (9, sampling_rate));
+ BOOST_CHECK_EQUAL (tb.size(), 0U);
/* Then there's our data at 9 */
tb = merger.pull (DCPTime::from_frames (9 + 64, sampling_rate));
/* Then there's our data at 9 */
tb = merger.pull (DCPTime::from_frames (9 + 64, sampling_rate));
- list<pair<shared_ptr<AudioBuffers>, DCPTime> > tb = merger.pull (DCPTime::from_frames (100, sampling_rate));
- BOOST_REQUIRE (tb.size() == 1);
+ auto tb = merger.pull (DCPTime::from_frames (100, sampling_rate));
+ BOOST_REQUIRE (tb.size() == 1U);
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->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->frames(), 64);
BOOST_CHECK_EQUAL (tb.front().second.get(), DCPTime::from_frames(114, sampling_rate).get());
for (int i = 0; i < 64; ++i) {
BOOST_CHECK_EQUAL (tb.front().first->frames(), 64);
BOOST_CHECK_EQUAL (tb.front().second.get(), DCPTime::from_frames(114, sampling_rate).get());
for (int i = 0; i < 64; ++i) {
/* Reply a sequence of calls to AudioMerger that resulted in a crash */
BOOST_AUTO_TEST_CASE (audio_merger_test4)
{
/* Reply a sequence of calls to AudioMerger that resulted in a crash */
BOOST_AUTO_TEST_CASE (audio_merger_test4)
{
DCPTime time(dcp::raw_convert<DCPTime::Type>(*i++));
BOOST_REQUIRE (i != tokens.end());
int const frames = dcp::raw_convert<int>(*i++);
DCPTime time(dcp::raw_convert<DCPTime::Type>(*i++));
BOOST_REQUIRE (i != tokens.end());
int const frames = dcp::raw_convert<int>(*i++);
BOOST_REQUIRE (merger);
merger->push (buffers, time);
} else if (cmd == "pull") {
BOOST_REQUIRE (merger);
merger->push (buffers, time);
} else if (cmd == "pull") {