diff options
author | nick_m <mainsbridge@gmail.com> | 2015-12-28 05:33:04 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:09 +1000 |
commit | 5c6e18e6a087823e4a3719177c92238b206e3aeb (patch) | |
tree | 25f7faefa65e630e68da70bf4378b825e7c29312 /libs/ardour/test | |
parent | 41c8b534b70e220b4d4b940aed8a98d9a57003ab (diff) |
Tempo ramps - remove the concept of bars from tempo sections.
- this helps where tempo and meter have a somewhat circular
dependency.
MetricSection now has a musical position expressed in beats (a double).
MeterSection still has a bbt, but it really isn't needed as we have
enough information to discover the number of bars at a given beat without it.
TempoSection now has a hack to enable loading of legacy sessions, which will
ultimately be a lot cleaner than the current code.
Removing bars from tempo sections also allows us to place them
at arbitrary frames (implemented here).
Diffstat (limited to 'libs/ardour/test')
-rw-r--r-- | libs/ardour/test/bbt_test.cc | 2 | ||||
-rw-r--r-- | libs/ardour/test/framepos_minus_beats_test.cc | 18 | ||||
-rw-r--r-- | libs/ardour/test/framepos_plus_beats_test.cc | 18 | ||||
-rw-r--r-- | libs/ardour/test/framewalk_to_beats_test.cc | 18 | ||||
-rw-r--r-- | libs/ardour/test/midi_clock_slave_test.h | 4 | ||||
-rw-r--r-- | libs/ardour/test/tempo_test.cc | 8 |
6 files changed, 34 insertions, 34 deletions
diff --git a/libs/ardour/test/bbt_test.cc b/libs/ardour/test/bbt_test.cc index 416d02ba14..507af574d2 100644 --- a/libs/ardour/test/bbt_test.cc +++ b/libs/ardour/test/bbt_test.cc @@ -16,7 +16,7 @@ BBTTest::addTest () Tempo tempo(120); Meter meter(4.0, 4.0); - map.add_meter (meter, BBT_Time(1, 1, 0)); + map.add_meter (meter, 0.0, BBT_Time(1, 1, 0)); /* add some good stuff here */ } diff --git a/libs/ardour/test/framepos_minus_beats_test.cc b/libs/ardour/test/framepos_minus_beats_test.cc index 6f1bba53b2..588a38c097 100644 --- a/libs/ardour/test/framepos_minus_beats_test.cc +++ b/libs/ardour/test/framepos_minus_beats_test.cc @@ -22,8 +22,8 @@ FrameposMinusBeatsTest::singleTempoTest () Tempo tempo (bpm); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); - map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); + map.add_tempo (tempo, 0.0, TempoSection::Type::Constant); /* Subtract 1 beat from beat 3 of the first bar */ framepos_t r = map.framepos_minus_beats (frames_per_beat * 2, Beats(1)); @@ -42,7 +42,7 @@ FrameposMinusBeatsTest::doubleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 4 @@ -63,9 +63,9 @@ FrameposMinusBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant); /* Now some tests */ @@ -94,7 +94,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () TempoMap map (sampling_rate); Meter meterA (4, 4); - map.add_meter (meterA, BBT_Time (1, 1, 0)); + map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 4 @@ -115,11 +115,11 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant); Meter meterB (3, 4); - map.add_meter (meterB, BBT_Time (4, 1, 0)); + map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0)); /* Now some tests */ diff --git a/libs/ardour/test/framepos_plus_beats_test.cc b/libs/ardour/test/framepos_plus_beats_test.cc index 425ae84343..ab52861f50 100644 --- a/libs/ardour/test/framepos_plus_beats_test.cc +++ b/libs/ardour/test/framepos_plus_beats_test.cc @@ -21,8 +21,8 @@ FrameposPlusBeatsTest::singleTempoTest () Tempo tempo (bpm); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); - map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); + map.add_tempo (tempo, 0.0, TempoSection::Type::Constant); /* Add 1 beat to beat 3 of the first bar */ framepos_t r = map.framepos_plus_beats (frames_per_beat * 2, Evoral::Beats(1)); @@ -41,7 +41,7 @@ FrameposPlusBeatsTest::doubleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 4 @@ -62,9 +62,9 @@ FrameposPlusBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant); /* Now some tests */ @@ -93,7 +93,7 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () TempoMap map (sampling_rate); Meter meterA (4, 4); - map.add_meter (meterA, BBT_Time (1, 1, 0)); + map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 4 @@ -114,11 +114,11 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant); Meter meterB (3, 4); - map.add_meter (meterB, BBT_Time (4, 1, 0)); + map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0)); /* Now some tests */ diff --git a/libs/ardour/test/framewalk_to_beats_test.cc b/libs/ardour/test/framewalk_to_beats_test.cc index 84ddf6fc30..f6e84ddfad 100644 --- a/libs/ardour/test/framewalk_to_beats_test.cc +++ b/libs/ardour/test/framewalk_to_beats_test.cc @@ -20,8 +20,8 @@ FramewalkToBeatsTest::singleTempoTest () Tempo tempo (bpm); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); - map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); + map.add_tempo (tempo, 0.0, TempoSection::Type::Constant); /* Walk 1 beats-worth of frames from beat 3 */ double r = map.framewalk_to_beats (frames_per_beat * 2, frames_per_beat * 1).to_double(); @@ -47,7 +47,7 @@ FramewalkToBeatsTest::doubleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 4 @@ -70,9 +70,9 @@ FramewalkToBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant); /* Now some tests */ @@ -103,7 +103,7 @@ FramewalkToBeatsTest::tripleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.add_meter (meter, BBT_Time (1, 1, 0)); + map.add_meter (meter, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 2, 160bpm at bar 3 @@ -125,11 +125,11 @@ FramewalkToBeatsTest::tripleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (2, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 4.0, TempoSection::Type::Constant); Tempo tempoC (160); - map.add_tempo (tempoC, BBT_Time (3, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoC, 8.0, TempoSection::Type::Constant); /* Walk from 1|3 to 4|1 */ double r = map.framewalk_to_beats (2 * 24e3, (2 * 24e3) + (4 * 12e3) + (4 * 18e3)).to_double(); diff --git a/libs/ardour/test/midi_clock_slave_test.h b/libs/ardour/test/midi_clock_slave_test.h index 392e2876e9..ba87f8892a 100644 --- a/libs/ardour/test/midi_clock_slave_test.h +++ b/libs/ardour/test/midi_clock_slave_test.h @@ -48,8 +48,8 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy { meter (4.0, 4.0) { _tempo_map = new TempoMap (FRAME_RATE); - _tempo_map->add_tempo (tempo, Timecode::BBT_Time(1, 1, 0), TempoSection::Type::Constant); - _tempo_map->add_meter (meter, Timecode::BBT_Time(1, 1, 0)); + _tempo_map->add_tempo (tempo, 0.0, TempoSection::Type::Constant); + _tempo_map->add_meter (meter, 0.0, Timecode::BBT_Time(1, 1, 0)); } // Controlling the mock object diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc index 04b24f6d73..a7f9c1d405 100644 --- a/libs/ardour/test/tempo_test.cc +++ b/libs/ardour/test/tempo_test.cc @@ -14,7 +14,7 @@ TempoTest::recomputeMapTest () TempoMap map (sampling_rate); Meter meterA (4, 4); - map.add_meter (meterA, BBT_Time (1, 1, 0)); + map.add_meter (meterA, 0.0, BBT_Time (1, 1, 0)); /* 120bpm at bar 1, 240bpm at bar 4 @@ -35,11 +35,11 @@ TempoTest::recomputeMapTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoA, 0.0, TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); + map.add_tempo (tempoB, 12.0, TempoSection::Type::Constant); Meter meterB (3, 4); - map.add_meter (meterB, BBT_Time (4, 1, 0)); + map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0)); list<MetricSection*>::iterator i = map.metrics.begin(); CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ()); |