X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Ftest%2Fframepos_minus_beats_test.cc;h=12f020e2d793cde457287e798b41cba6d3926b4d;hb=22b07e0233a29d9633ffa825a79503befaf2e16e;hp=01bafc1606f4d77f5f76c5268549ca3bc6d027de;hpb=748b24009bb1b4b104411eb75527d2ec09415c91;p=ardour.git diff --git a/libs/ardour/test/framepos_minus_beats_test.cc b/libs/ardour/test/framepos_minus_beats_test.cc index 01bafc1606..12f020e2d7 100644 --- a/libs/ardour/test/framepos_minus_beats_test.cc +++ b/libs/ardour/test/framepos_minus_beats_test.cc @@ -7,6 +7,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION (FrameposMinusBeatsTest); using namespace std; using namespace ARDOUR; using namespace Timecode; +using namespace Evoral; /* Basic tests with no tempo / meter changes */ void @@ -16,7 +17,7 @@ FrameposMinusBeatsTest::singleTempoTest () int const bpm = 120; double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate); - + TempoMap map (sampling_rate); Tempo tempo (bpm); Meter meter (4, 4); @@ -25,11 +26,11 @@ FrameposMinusBeatsTest::singleTempoTest () map.add_tempo (tempo, BBT_Time (1, 1, 0)); /* Subtract 1 beat from beat 3 of the first bar */ - framepos_t r = map.framepos_minus_beats (frames_per_beat * 2, 1); + framepos_t r = map.framepos_minus_beats (frames_per_beat * 2, Beats(1)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (frames_per_beat * 1)); /* Subtract 4 beats from 3 beats in, to go beyond zero */ - r = map.framepos_minus_beats (frames_per_beat * 3, 4); + r = map.framepos_minus_beats (frames_per_beat * 3, Beats(4)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (- frames_per_beat)); } @@ -45,14 +46,14 @@ FrameposMinusBeatsTest::doubleTempoTest () /* 120bpm at bar 1, 240bpm at bar 4 - + 120bpm = 24e3 samples per beat 240bpm = 12e3 samples per beat */ - + /* - + 120bpm 240bpm 0 beats 12 beats 0 frames 288e3 frames @@ -69,15 +70,15 @@ FrameposMinusBeatsTest::doubleTempoTest () /* Now some tests */ /* Subtract 1 beat from 1|2 */ - framepos_t r = map.framepos_minus_beats (24e3, 1); + framepos_t r = map.framepos_minus_beats (24e3, Beats(1)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (0)); /* Subtract 2 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, 2); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3)); /* Subtract 2.5 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, 2.5); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2.5)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3)); } @@ -85,7 +86,7 @@ FrameposMinusBeatsTest::doubleTempoTest () tempo change (which shouldn't affect anything, since we are just dealing with beats) */ - + void FrameposMinusBeatsTest::doubleTempoWithMeterTest () { @@ -97,14 +98,14 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () /* 120bpm at bar 1, 240bpm at bar 4 - + 120bpm = 24e3 samples per beat 240bpm = 12e3 samples per beat */ - + /* - + 120bpm 240bpm 0 beats 12 beats 0 frames 288e3 frames @@ -123,15 +124,15 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () /* Now some tests */ /* Subtract 1 beat from 1|2 */ - framepos_t r = map.framepos_minus_beats (24e3, 1); + framepos_t r = map.framepos_minus_beats (24e3, Beats(1)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (0)); /* Subtract 2 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, 2); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3)); /* Subtract 2.5 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_beats (288e3 + 12e3, 2.5); + r = map.framepos_minus_beats (288e3 + 12e3, Beats(2.5)); CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3)); }