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/ardour/tempo.h | 15 ++--- libs/ardour/tempo.cc | 81 ++++++++------------------- 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 ++++++++++++++-------------- 6 files changed, 86 insertions(+), 123 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 8fc8966462..4f44ac5455 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -200,8 +200,8 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { Constant, }; - TempoSection (const double& pulse, const double& minute, Tempo tempo, Type tempo_type, PositionLockStyle pls, framecnt_t sr) - : MetricSection (pulse, minute, pls, true, sr), Tempo (tempo), _type (tempo_type), _c (0.0), _active (true), _locked_to_meter (false) {} + TempoSection (const double& pulse, const double& minute, Tempo tempo, PositionLockStyle pls, framecnt_t sr) + : MetricSection (pulse, minute, pls, true, sr), Tempo (tempo), _c (0.0), _active (true), _locked_to_meter (false) {} TempoSection (const XMLNode&, const framecnt_t sample_rate); @@ -212,8 +212,7 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { double c () const { return _c; } void set_c (double c) { _c = c; } - void set_type (Type type); - Type type () const { return _type; } + Type type () const { if (note_types_per_minute() == end_note_types_per_minute()) { return Constant; } else { return Ramp; } } bool active () const { return _active; } void set_active (bool yn) { _active = yn; } @@ -265,7 +264,6 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { this enables us to keep the tempo change at the same relative position within the bar if/when the meter changes. */ - Type _type; double _c; bool _active; bool _locked_to_meter; @@ -374,7 +372,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible * @param frame frame position of new section. ignored if pls == MusicTime * @param type type of new tempo section (Ramp, Constant) */ - TempoSection* add_tempo (const Tempo&, const double& pulse, const framepos_t& frame, TempoSection::Type type, PositionLockStyle pls); + TempoSection* add_tempo (const Tempo&, const double& pulse, const framepos_t& frame, PositionLockStyle pls); /** add a meter section locked to pls.. ignored values will be set in recompute_meters() * @param meter the Meter to be added @@ -394,8 +392,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible void remove_tempo (const TempoSection&, bool send_signal); void remove_meter (const MeterSection&, bool send_signal); - void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const framepos_t& frame - , TempoSection::Type type, PositionLockStyle pls); + void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const framepos_t& frame, PositionLockStyle pls); void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls); @@ -589,7 +586,7 @@ private: void do_insert (MetricSection* section); TempoSection* add_tempo_locked (const Tempo&, double pulse, double minute - , TempoSection::Type type, PositionLockStyle pls, bool recompute, bool locked_to_meter = false); + , PositionLockStyle pls, bool recompute, bool locked_to_meter = false); MeterSection* add_meter_locked (const Meter&, double beat, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls, bool recompute); diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 8aa6f3953c..e600382aa5 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -171,12 +171,6 @@ TempoSection::TempoSection (const XMLNode& node, framecnt_t sample_rate) set_active (string_is_affirmative (prop->value())); } - if ((prop = node.property ("tempo-type")) == 0) { - _type = Constant; - } else { - _type = Type (string_2_enum (prop->value(), _type)); - } - if ((prop = node.property ("lock-style")) == 0) { if (!initial()) { set_position_lock_style (MusicTime); @@ -224,25 +218,18 @@ TempoSection::get_state() const root->add_property ("movable", buf); snprintf (buf, sizeof (buf), "%s", active()?"yes":"no"); root->add_property ("active", buf); - root->add_property ("tempo-type", enum_2_string (_type)); root->add_property ("lock-style", enum_2_string (position_lock_style())); root->add_property ("locked-to-meter", locked_to_meter()?"yes":"no"); return *root; } -void -TempoSection::set_type (Type type) -{ - _type = type; -} - /** returns the Tempo at the session-relative minute. */ Tempo TempoSection::tempo_at_minute (const double& m) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && m < minute()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && m < minute()); if (constant) { return Tempo (note_types_per_minute(), note_type()); } @@ -268,7 +255,7 @@ TempoSection::tempo_at_minute (const double& m) const double TempoSection::minute_at_ntpm (const double& ntpm, const double& p) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && p < pulse()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && p < pulse()); if (constant) { return ((p - pulse()) / pulses_per_minute()) + minute(); } @@ -281,7 +268,7 @@ TempoSection::minute_at_ntpm (const double& ntpm, const double& p) const Tempo TempoSection::tempo_at_pulse (const double& p) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && p < pulse()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && p < pulse()); if (constant) { return Tempo (note_types_per_minute(), note_type()); @@ -303,7 +290,7 @@ TempoSection::tempo_at_pulse (const double& p) const double TempoSection::pulse_at_ntpm (const double& ntpm, const double& m) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && m < minute()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && m < minute()); if (constant) { return ((m - minute()) * pulses_per_minute()) + pulse(); } @@ -316,7 +303,7 @@ TempoSection::pulse_at_ntpm (const double& ntpm, const double& m) const double TempoSection::pulse_at_minute (const double& m) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && m < minute()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && m < minute()); if (constant) { return ((m - minute()) * pulses_per_minute()) + pulse(); } @@ -329,7 +316,7 @@ TempoSection::pulse_at_minute (const double& m) const double TempoSection::minute_at_pulse (const double& p) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && p < pulse()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && p < pulse()); if (constant) { return ((p - pulse()) / pulses_per_minute()) + minute(); } @@ -346,7 +333,7 @@ TempoSection::minute_at_pulse (const double& p) const double TempoSection::pulse_at_frame (const framepos_t& f) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && f < frame()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && f < frame()); if (constant) { return (minute_at_frame (f - frame()) * pulses_per_minute()) + pulse(); } @@ -357,7 +344,7 @@ TempoSection::pulse_at_frame (const framepos_t& f) const framepos_t TempoSection::frame_at_pulse (const double& p) const { - const bool constant = _type == Constant || _c == 0.0 || (initial() && p < pulse()); + const bool constant = type() == Constant || _c == 0.0 || (initial() && p < pulse()); if (constant) { return frame_at_minute (((p - pulse()) / pulses_per_minute()) + minute()); } @@ -448,7 +435,7 @@ https://www.zhdk.ch/fileadmin/data_subsites/data_icst/Downloads/Timegrid/ICST_Te double TempoSection::compute_c_pulse (const double& end_npm, const double& end_pulse) const { - if (note_types_per_minute() == end_npm || _type == Constant) { + if (note_types_per_minute() == end_npm || type() == Constant) { return 0.0; } @@ -464,7 +451,7 @@ TempoSection::compute_c_pulse (const double& end_npm, const double& end_pulse) c double TempoSection::compute_c_minute (const double& end_npm, const double& end_minute) const { - if (note_types_per_minute() == end_npm || _type == Constant) { + if (note_types_per_minute() == end_npm || type() == Constant) { return 0.0; } @@ -761,7 +748,7 @@ TempoMap::TempoMap (framecnt_t fr) _frame_rate = fr; BBT_Time start (1, 1, 0); - TempoSection *t = new TempoSection (0.0, 0.0, _default_tempo, TempoSection::Ramp, AudioTime, fr); + TempoSection *t = new TempoSection (0.0, 0.0, _default_tempo, AudioTime, fr); MeterSection *m = new MeterSection (0.0, 0.0, 0.0, start, _default_meter.divisions_per_bar(), _default_meter.note_divisor(), AudioTime, fr); t->set_initial (true); @@ -989,10 +976,6 @@ TempoMap::do_insert (MetricSection* section) *(dynamic_cast(*i)) = *(dynamic_cast(insert_tempo)); (*i)->set_position_lock_style (AudioTime); - TempoSection* t; - if ((t = dynamic_cast(*i)) != 0) { - t->set_type (insert_tempo->type()); - } need_add = false; } else { delete (*i); @@ -1080,7 +1063,7 @@ TempoMap::do_insert (MetricSection* section) } /* user supplies the exact pulse if pls == MusicTime */ TempoSection* -TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t& frame, ARDOUR::TempoSection::Type type, PositionLockStyle pls) +TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t& frame, PositionLockStyle pls) { if (tempo.note_types_per_minute() <= 0.0) { warning << "Cannot add tempo. note types per minute must be greater than zero." << endmsg; @@ -1091,7 +1074,7 @@ TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t& TempoSection* prev_tempo = 0; { Glib::Threads::RWLock::WriterLock lm (lock); - ts = add_tempo_locked (tempo, pulse, minute_at_frame (frame), type, pls, true); + ts = add_tempo_locked (tempo, pulse, minute_at_frame (frame), pls, true); for (Metrics::iterator i = _metrics.begin(); i != _metrics.end(); ++i) { if ((*i)->is_tempo()) { @@ -1118,7 +1101,7 @@ TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t& } void -TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pulse, const framepos_t& frame, TempoSection::Type type, PositionLockStyle pls) +TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pulse, const framepos_t& frame, PositionLockStyle pls) { if (tempo.note_types_per_minute() <= 0.0) { warning << "Cannot replace tempo. note types per minute must be greater than zero." << endmsg; @@ -1133,7 +1116,6 @@ TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pul TempoSection& first (first_tempo()); if (!ts.initial()) { if (locked_to_meter) { - ts.set_type (type); { /* cannot move a meter-locked tempo section */ *static_cast(&ts) = tempo; @@ -1141,7 +1123,7 @@ TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pul } } else { remove_tempo_locked (ts); - new_ts = add_tempo_locked (tempo, pulse, minute_at_frame (frame), type, pls, true, locked_to_meter); + new_ts = add_tempo_locked (tempo, pulse, minute_at_frame (frame), pls, true, locked_to_meter); if (new_ts && new_ts->type() == TempoSection::Constant) { new_ts->set_end_note_types_per_minute (new_ts->note_types_per_minute()); @@ -1165,7 +1147,6 @@ TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pul } } else { - first.set_type (type); first.set_pulse (0.0); first.set_minute (minute_at_frame (frame)); first.set_position_lock_style (AudioTime); @@ -1183,9 +1164,9 @@ TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pul TempoSection* TempoMap::add_tempo_locked (const Tempo& tempo, double pulse, double minute - , TempoSection::Type type, PositionLockStyle pls, bool recompute, bool locked_to_meter) + , PositionLockStyle pls, bool recompute, bool locked_to_meter) { - TempoSection* t = new TempoSection (pulse, minute, tempo, type, pls, _frame_rate); + TempoSection* t = new TempoSection (pulse, minute, tempo, pls, _frame_rate); t->set_locked_to_meter (locked_to_meter); do_insert (t); @@ -1263,7 +1244,7 @@ TempoMap::add_meter_locked (const Meter& meter, double beat, const BBT_Time& whe if (pls == AudioTime) { /* add meter-locked tempo */ - mlt = add_tempo_locked (tempo_at_minute_locked (_metrics, time_minutes), pulse, minute_at_frame (frame), TempoSection::Ramp, AudioTime, true, true); + mlt = add_tempo_locked (tempo_at_minute_locked (_metrics, time_minutes), pulse, minute_at_frame (frame), AudioTime, true, true); if (!mlt) { return 0; @@ -3483,10 +3464,7 @@ TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const fra goto out; } - /* this should be everywhere. no _type because type() is constant if note_types_per_minute() == end_types_per_minute() - but what to do with legact sessions? - */ - if (prev_t && prev_t->note_types_per_minute() != prev_t->end_note_types_per_minute()) { + if (prev_t && prev_t->type() == TempoSection::Ramp) { prev_t->set_note_types_per_minute (new_bpm); } else { prev_t->set_end_note_types_per_minute (new_bpm); @@ -3497,7 +3475,7 @@ TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const fra recompute_meters (future_map); if (check_solved (future_map)) { - if (prev_t && prev_t->note_types_per_minute() != prev_t->end_note_types_per_minute()) { + if (prev_t && prev_t->type() == TempoSection::Ramp) { ts->set_note_types_per_minute (new_bpm); } else { ts->set_end_note_types_per_minute (new_bpm); @@ -3575,27 +3553,14 @@ TempoMap::gui_stretch_tempo_end (TempoSection* ts, const framepos_t frame, const goto out; } - if (prev_t && prev_t->type() == TempoSection::Ramp) { - prev_t->set_end_note_types_per_minute (new_bpm); - } else { - if (prev_t) { - prev_t->set_note_types_per_minute (new_bpm); - prev_t->set_end_note_types_per_minute (prev_t->note_types_per_minute()); - } - } + prev_t->set_end_note_types_per_minute (new_bpm); recompute_tempi (future_map); recompute_meters (future_map); if (check_solved (future_map)) { - if (prev_t && prev_t->type() == TempoSection::Ramp) { - ts->set_end_note_types_per_minute (new_bpm); - } else { - if (prev_t) { - ts->set_end_note_types_per_minute (prev_t->note_types_per_minute()); - ts->set_note_types_per_minute (prev_t->note_types_per_minute()); - } - } + ts->set_end_note_types_per_minute (new_bpm); + recompute_tempi (_metrics); recompute_meters (_metrics); } 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