From 97c4c2a28c19b7979ecbfd2eff28a351dfae1e6a Mon Sep 17 00:00:00 2001 From: nick_m Date: Sun, 26 Feb 2017 02:22:19 +1100 Subject: complete changes to tempo type. - this implements in the intention behind the previous commit. a tempo mark is constant until its end has been changed by a shift-drag on the next marker. --- libs/ardour/test/framepos_plus_beats_test.cc | 14 ++--- libs/ardour/test/framewalk_to_beats_test.cc | 14 ++--- libs/ardour/test/midi_clock_slave_test.h | 2 +- libs/ardour/test/tempo_test.cc | 83 ++++++++++++++-------------- 4 files changed, 57 insertions(+), 56 deletions(-) (limited to 'libs/ardour/test') diff --git a/libs/ardour/test/framepos_plus_beats_test.cc b/libs/ardour/test/framepos_plus_beats_test.cc index c59578772c..cb5211b007 100644 --- a/libs/ardour/test/framepos_plus_beats_test.cc +++ b/libs/ardour/test/framepos_plus_beats_test.cc @@ -22,7 +22,7 @@ FrameposPlusBeatsTest::singleTempoTest () Meter meter (4, 4); map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.first_tempo(), tempo, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempo, 0.0, 0, AudioTime); /* Add 1 beat to beat 3 of the first bar */ framepos_t r = map.framepos_plus_qn (frames_per_beat * 2, Evoral::Beats(1)); @@ -63,9 +63,9 @@ FrameposPlusBeatsTest::doubleTempoTest () */ Tempo tempoA (120, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240, 4.0); - map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, MusicTime); /* Now some tests */ @@ -116,9 +116,9 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () */ Tempo tempoA (120, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240, 4.0); - map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 12.0 / tempoA.note_type(), 0, MusicTime); Meter meterB (3, 8); map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0), 0, MusicTime); @@ -173,9 +173,9 @@ FrameposPlusBeatsTest::doubleTempoWithComplexMeterTest () */ Tempo tempoA (120, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240, 4.0); - map.add_tempo (tempoB, 12.0 / 4.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 12.0 / 4.0, 0, MusicTime); Meter meterB (5, 8); map.add_meter (meterB, 9.0, BBT_Time (4, 1, 0), 0, MusicTime); /* Now some tests */ diff --git a/libs/ardour/test/framewalk_to_beats_test.cc b/libs/ardour/test/framewalk_to_beats_test.cc index 78d8c113ed..8c430b9230 100644 --- a/libs/ardour/test/framewalk_to_beats_test.cc +++ b/libs/ardour/test/framewalk_to_beats_test.cc @@ -21,7 +21,7 @@ FramewalkToBeatsTest::singleTempoTest () Meter meter (4, 4); map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, AudioTime); /* Walk 1 beats-worth of frames from beat 3 */ double r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1).to_double(); @@ -71,9 +71,9 @@ FramewalkToBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240); - map.add_tempo (tempoB, 12.0 / tempoB.note_type(), 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 12.0 / tempoB.note_type(), 0, MusicTime); /* Now some tests */ @@ -127,11 +127,11 @@ FramewalkToBeatsTest::tripleTempoTest () */ Tempo tempoA (120, 4.0); - map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240, 4.0); - map.add_tempo (tempoB, 4.0 / tempoB.note_type(), 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 4.0 / tempoB.note_type(), 0, MusicTime); Tempo tempoC (160, 4.0); - map.add_tempo (tempoC, 8.0 / tempoB.note_type(), 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoC, 8.0 / tempoB.note_type(), 0, MusicTime); /* Walk from 1|3 to 4|1 */ double r = map.framewalk_to_qn (2 * 24e3, (2 * 24e3) + (4 * 12e3) + (4 * 18e3)).to_double(); @@ -151,7 +151,7 @@ FramewalkToBeatsTest::singleTempoMeterTest () Meter meter (7, 8); map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, AudioTime); /* Walk 1 qn beats-worth of frames from beat 3 */ double r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1).to_double(); diff --git a/libs/ardour/test/midi_clock_slave_test.h b/libs/ardour/test/midi_clock_slave_test.h index 2a674aed10..3423fede13 100644 --- a/libs/ardour/test/midi_clock_slave_test.h +++ b/libs/ardour/test/midi_clock_slave_test.h @@ -48,7 +48,7 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy { meter (4.0, 4.0) { _tempo_map = new TempoMap (FRAME_RATE); - _tempo_map->add_tempo (tempo, 0.0, 0, TempoSection::Constant, AudioTime); + _tempo_map->add_tempo (tempo, 0.0, 0, AudioTime); _tempo_map->add_meter (meter, 0.0, Timecode::BBT_Time(1, 1, 0), 0, AudioTime); } diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc index 52d7d4ea1f..9e86b6d7ae 100644 --- a/libs/ardour/test/tempo_test.cc +++ b/libs/ardour/test/tempo_test.cc @@ -36,9 +36,9 @@ TempoTest::recomputeMapTest48 () */ Tempo tempoA (120.0, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240.0, 4.0); - map.add_tempo (tempoB, 3.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 3.0, 0, MusicTime); Meter meterB (3, 4); map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0), 0, MusicTime); //map.dump (map._metrics, std::cout); @@ -134,9 +134,9 @@ TempoTest::recomputeMapTest44 () */ Tempo tempoA (120.0, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240.0, 4.0); - map.add_tempo (tempoB, 3.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 3.0, 0, MusicTime); Meter meterB (3, 4); map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0), 288e3, MusicTime); @@ -234,21 +234,21 @@ TempoTest::qnDistanceTestConstant () */ Tempo tempoA (120.0, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); /* should have no effect on pulse */ Tempo tempoB (120.0, 4.0); - map.add_tempo (tempoB, 2.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 2.0, 0, MusicTime); /* equivalent to pulse 3.0 @ 120 bpm*/ Tempo tempoC (240.0, 4.0); - map.add_tempo (tempoC, 0.0, 6 * sampling_rate, TempoSection::Constant, AudioTime); + map.add_tempo (tempoC, 0.0, 6 * sampling_rate, AudioTime); Tempo tempoD (90.4, 4.0); - map.add_tempo (tempoD, 9.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoD, 9.0, 0, MusicTime); Tempo tempoE (110.6, 4.0); - map.add_tempo (tempoE, 12.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoE, 12.0, 0, MusicTime); Tempo tempoF (123.7, 4.0); - map.add_tempo (tempoF, 15.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoF, 15.0, 0, MusicTime); Tempo tempoG (111.8, 4.0); - map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, TempoSection::Constant, AudioTime); + map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, AudioTime); Meter meterB (3, 4); map.add_meter (meterB, 12.0, BBT_Time (4, 1, 0), 288e3, MusicTime); @@ -313,23 +313,24 @@ TempoTest::qnDistanceTestRamp () */ - Tempo tempoA (120.2, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Ramp, AudioTime); - Tempo tempoB (240.5, 4.0); - map.add_tempo (tempoB, 3.0, 0, TempoSection::Ramp, MusicTime); - - Tempo tempoC (130.1, 4.0); - map.add_tempo (tempoC, 0.0, 6 * sampling_rate, TempoSection::Ramp, AudioTime); - Tempo tempoD (90.3, 4.0); - map.add_tempo (tempoD, 9.0, 0, TempoSection::Ramp, MusicTime); - Tempo tempoE (110.7, 4.0); - map.add_tempo (tempoE, 12.0, 0, TempoSection::Ramp, MusicTime); - Tempo tempoF (123.9, 4.0); - map.add_tempo (tempoF, 15.0, 0, TempoSection::Ramp, MusicTime); + Tempo tempoA (120.2, 4.0, 240.5); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); + Tempo tempoB (240.5, 4.0, 130.1); + map.add_tempo (tempoB, 3.0, 0, MusicTime); + + Tempo tempoC (130.1, 4.0, 90.3); + map.add_tempo (tempoC, 0.0, 6 * sampling_rate, AudioTime); + Tempo tempoD (90.3, 4.0, 110.7); + map.add_tempo (tempoD, 9.0, 0, MusicTime); + Tempo tempoE (110.7, 4.0, 123.9); + map.add_tempo (tempoE, 12.0, 0, MusicTime); + Tempo tempoF (123.9, 4.0, 111.8); + map.add_tempo (tempoF, 15.0, 0, MusicTime); Tempo tempoG (111.8, 4.0); - map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, TempoSection::Ramp, AudioTime); + map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, AudioTime); Meter meterB (3, 4); map.add_meter (meterB, 4.0, BBT_Time (2, 1, 0), 288e3, AudioTime); + map.dump (std::cout); map.recompute_map (map._metrics, 1); list::iterator i = map._metrics.begin(); @@ -367,10 +368,10 @@ TempoTest::rampTest48 () TempoMap map (sampling_rate); Meter meterA (4, 4); - Tempo tempoA (77.0, 4.0); + Tempo tempoA (77.0, 4.0, 217.0); Tempo tempoB (217.0, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Ramp, AudioTime); - map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, TempoSection::Ramp, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); + map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, AudioTime); map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime); /* @@ -429,10 +430,10 @@ TempoTest::rampTest44 () TempoMap map (sampling_rate); Meter meterA (4, 4); - Tempo tempoA (77.0, 4.0); + Tempo tempoA (77.0, 4.0, 217.0); Tempo tempoB (217.0, 4.0); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Ramp, AudioTime); - map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, TempoSection::Ramp, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); + map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, AudioTime); map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime); /* @@ -491,15 +492,15 @@ TempoTest::tempoAtPulseTest () TempoMap map (sampling_rate); Meter meterA (4, 8); - Tempo tempoA (80.0, 8.0); - Tempo tempoB (160.0, 3.0); + Tempo tempoA (80.0, 8.0, 160.0); + Tempo tempoB (160.0, 3.0, 123.0); Tempo tempoC (123.0, 4.0); map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Ramp, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); - map.add_tempo (tempoB, 20.0, 0, TempoSection::Ramp, MusicTime); - map.add_tempo (tempoC, 30.0, 0, TempoSection::Ramp, MusicTime); + map.add_tempo (tempoB, 20.0, 0, MusicTime); + map.add_tempo (tempoC, 30.0, 0, MusicTime); TempoSection* tA = 0; TempoSection* tB = 0; @@ -569,13 +570,13 @@ TempoTest::tempoFundamentalsTest () Tempo tempoE (123.0, 3.0); map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, TempoSection::Constant, AudioTime); + map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); - map.add_tempo (tempoB, 20.0, 0, TempoSection::Constant, MusicTime); - map.add_tempo (tempoC, 30.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoB, 20.0, 0, MusicTime); + map.add_tempo (tempoC, 30.0, 0, MusicTime); - map.add_tempo (tempoD, 40.0, 0, TempoSection::Constant, MusicTime); - map.add_tempo (tempoE, 50.0, 0, TempoSection::Constant, MusicTime); + map.add_tempo (tempoD, 40.0, 0, MusicTime); + map.add_tempo (tempoE, 50.0, 0, MusicTime); TempoSection* tA = 0; TempoSection* tB = 0; -- cgit v1.2.3