summaryrefslogtreecommitdiff
path: root/libs/ardour/test/tempo_test.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-04-02 03:23:51 +1100
committernick_m <mainsbridge@gmail.com>2016-05-27 23:38:13 +1000
commitd3f0e651998be01f75bb334e36a4329c9772af40 (patch)
treebce7837fa07a87a5e816746c78ab1ad313452958 /libs/ardour/test/tempo_test.cc
parentb71235519ab29ca575542fa8d2f486f71976d8b5 (diff)
Tempo ramps - tempo related tests pass, add ramp test.
Diffstat (limited to 'libs/ardour/test/tempo_test.cc')
-rw-r--r--libs/ardour/test/tempo_test.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc
index aa425134ae..9a6229124f 100644
--- a/libs/ardour/test/tempo_test.cc
+++ b/libs/ardour/test/tempo_test.cc
@@ -29,6 +29,7 @@ TempoTest::recomputeMapTest ()
120bpm 240bpm
0 beats 12 beats
0 frames 288e3 frames
+ 0 pulses 4 pulses
| | | | |
| 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
@@ -48,3 +49,45 @@ TempoTest::recomputeMapTest ()
--i;
CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), (*i)->frame ());
}
+
+void
+TempoTest::rampTest ()
+{
+ int const sampling_rate = 48000;
+
+ TempoMap map (sampling_rate);
+ Meter meterA (4, 4);
+ Tempo tempoA (77.0, 4.0);
+ Tempo tempoB (217.0, 4.0);
+ map.add_tempo (tempoA, 0.0, TempoSection::Ramp);
+ map.add_tempo (tempoB, 100.0, TempoSection::Ramp);
+ map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0));
+
+ /*
+
+ 120bpm 240bpm
+ 0 beats 12 beats
+ 0 frames 288e3 frames
+ 0 pulses 4 pulses
+ | | | | |
+ | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 |
+
+ */
+
+ TempoSection* tA = 0;
+ TempoSection* tB;
+ list<MetricSection*>::iterator i;
+
+ for (i = map._metrics.begin(); i != map._metrics.end(); ++i) {
+ if ((tB = dynamic_cast<TempoSection*> (*i)) != 0) {
+ if (tA) {
+ break;
+ }
+ tA = tB;
+ }
+ }
+ map.recompute_map (map._metrics);
+
+ CPPUNIT_ASSERT_EQUAL (tB->frame(), tA->frame_at_tempo (tB->beats_per_minute() / tB->note_type(), 100.0, sampling_rate));
+ CPPUNIT_ASSERT_EQUAL (tB->frame(), tA->frame_at_pulse (tB->pulse(), sampling_rate));
+}