diff options
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/tempo_dialog.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/tempo_dialog.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 18 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 2 | ||||
-rw-r--r-- | libs/ardour/midi_clock_slave.cc | 2 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 18 | ||||
-rw-r--r-- | libs/ardour/test/framepos_minus_beats_test.cc | 10 | ||||
-rw-r--r-- | libs/ardour/test/framepos_plus_beats_test.cc | 10 | ||||
-rw-r--r-- | libs/ardour/test/framewalk_to_beats_test.cc | 12 | ||||
-rw-r--r-- | libs/ardour/test/midi_clock_slave_test.h | 2 | ||||
-rw-r--r-- | libs/ardour/test/tempo_test.cc | 4 |
12 files changed, 49 insertions, 47 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 8302f1b778..f094c793ac 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6480,7 +6480,9 @@ Editor::define_one_bar (framepos_t start, framepos_t end) /* length = 1 bar */ - /* now we want frames per beat. + /* We're going to deliver a constant tempo here, + so we can use frames per beat to determine length. + now we want frames per beat. we have frames per bar, and beats per bar, so ... */ @@ -6552,7 +6554,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end) } else { Timecode::BBT_Time bbt; _session->tempo_map().bbt_time (start, bbt); - _session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), bbt, TempoSection::TempoSectionType::Ramp); + _session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), bbt, TempoSection::Type::Constant); } XMLNode& after (_session->tempo_map().get_state()); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 613a2d9a5a..2c45d50085 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -108,9 +108,9 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type, strings.clear(); - tempo_types.insert (make_pair (_("ramped"), TempoSection::TempoSectionType::Ramp)); + tempo_types.insert (make_pair (_("ramped"), TempoSection::Type::Ramp)); strings.push_back (_("ramped")); - tempo_types.insert (make_pair (_("constant"), TempoSection::TempoSectionType::Constant)); + tempo_types.insert (make_pair (_("constant"), TempoSection::Type::Constant)); strings.push_back (_("constant")); set_popdown_strings (tempo_type, strings); tempo_type.set_active_text (strings[0]); // "ramped" @@ -272,14 +272,14 @@ TempoDialog::get_note_type () return x->second; } -TempoSection::TempoSectionType +TempoSection::Type TempoDialog::get_tempo_type () { TempoTypes::iterator x = tempo_types.find (tempo_type.get_active_text()); if (x == tempo_types.end()) { error << string_compose(_("incomprehensible pulse note type (%1)"), tempo_type.get_active_text()) << endmsg; - return TempoSection::TempoSectionType::Constant; + return TempoSection::Type::Constant; } return x->second; diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index 842c2f2c3c..89f93016a2 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -44,7 +44,7 @@ public: double get_bpm (); double get_note_type (); bool get_bbt_time (Timecode::BBT_Time&); - ARDOUR::TempoSection::TempoSectionType get_tempo_type (); + ARDOUR::TempoSection::Type get_tempo_type (); private: void init (const Timecode::BBT_Time& start, double, double, bool); @@ -61,7 +61,7 @@ private: typedef std::map<std::string,float> NoteTypes; NoteTypes note_types; - typedef std::map<std::string, ARDOUR::TempoSection::TempoSectionType> TempoTypes; + typedef std::map<std::string, ARDOUR::TempoSection::Type> TempoTypes; TempoTypes tempo_types; bool tapped; // whether the tap-tempo button has been clicked diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 9a22484142..5f51124372 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -147,14 +147,14 @@ class LIBARDOUR_API MeterSection : public MetricSection, public Meter { /** A section of timeline with a certain Tempo. */ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { public: - enum TempoSectionType { + enum Type { Ramp, Constant, }; - TempoSection (const Timecode::BBT_Time& start, double qpm, double note_type, TempoSectionType tempo_type) + TempoSection (const Timecode::BBT_Time& start, double qpm, double note_type, Type tempo_type) : MetricSection (start), Tempo (qpm, note_type), _bar_offset (-1.0), _type (tempo_type) {} - TempoSection (framepos_t start, double qpm, double note_type, TempoSectionType tempo_type) + TempoSection (framepos_t start, double qpm, double note_type, Type tempo_type) : MetricSection (start), Tempo (qpm, note_type), _bar_offset (-1.0), _type (tempo_type) {} TempoSection (const XMLNode&); @@ -166,8 +166,8 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { void update_bbt_time_from_bar_offset (const Meter&); double bar_offset() const { return _bar_offset; } - void set_type (TempoSectionType type); - TempoSectionType type () const { return _type; } + void set_type (Type type); + Type type () const { return _type; } double tempo_at_frame (framepos_t frame, double end_bpm, framepos_t end_frame, framecnt_t frame_rate) const; framepos_t frame_at_tempo (double tempo, double end_bpm, framepos_t end_frame, framecnt_t frame_rate) const; @@ -210,7 +210,7 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { position within the bar if/when the meter changes. */ double _bar_offset; - TempoSectionType _type; + Type _type; }; typedef std::list<MetricSection*> Metrics; @@ -343,13 +343,13 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible TempoSection* tempo_section_after (framepos_t) const; const MeterSection& meter_section_at (framepos_t) const; - void add_tempo (const Tempo&, Timecode::BBT_Time where, TempoSection::TempoSectionType type); + void add_tempo (const Tempo&, Timecode::BBT_Time where, TempoSection::Type type); void add_meter (const Meter&, Timecode::BBT_Time where); void remove_tempo (const TempoSection&, bool send_signal); void remove_meter (const MeterSection&, bool send_signal); - void replace_tempo (const TempoSection&, const Tempo&, const Timecode::BBT_Time& where, TempoSection::TempoSectionType type); + void replace_tempo (const TempoSection&, const Tempo&, const Timecode::BBT_Time& where, TempoSection::Type type); void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where); framepos_t round_to_bar (framepos_t frame, RoundMode dir); @@ -415,7 +415,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible void do_insert (MetricSection* section); - void add_tempo_locked (const Tempo&, Timecode::BBT_Time where, bool recompute, TempoSection::TempoSectionType type); + void add_tempo_locked (const Tempo&, Timecode::BBT_Time where, bool recompute, TempoSection::Type type); void add_meter_locked (const Meter&, Timecode::BBT_Time where, bool recompute); bool remove_tempo_locked (const TempoSection&); diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 6a927680aa..3b6f227b10 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1810,7 +1810,7 @@ AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNe *outDeltaSampleOffsetToNextBeat = 0; } else { *outDeltaSampleOffsetToNextBeat = (UInt32) - double beat_frac_to_next = (Timecode::BBT_Time::ticks_per_beat - bbt.ticks) / Timecode::BBT_Time::ticks_per_beat ; + double const beat_frac_to_next = (Timecode::BBT_Time::ticks_per_beat - bbt.ticks) / Timecode::BBT_Time::ticks_per_beat; tmap.frame_at_beat (tmap.beat_at_frame (_session.transport_frame() + input_offset) + beat_frac_to_next); } } diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 44bb31e05c..c7acb1b58c 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -83,7 +83,7 @@ void MIDIClock_Slave::calculate_one_ppqn_in_frames_at(framepos_t time) { const Tempo& current_tempo = session->tempo_map().tempo_at(time); - double frames_per_beat = session->tempo_map().frames_per_beat_at (time, session->frame_rate()); + double const frames_per_beat = session->tempo_map().frames_per_beat_at (time, session->frame_rate()); double quarter_notes_per_beat = 4.0 / current_tempo.note_type(); double frames_per_quarter_note = frames_per_beat / quarter_notes_per_beat; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 50ec59264c..ef7c7d0239 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -128,12 +128,12 @@ TempoSection::TempoSection (const XMLNode& node) } if ((prop = node.property ("tempo-type")) == 0) { - _type = TempoSectionType::Constant; + _type = Type::Constant; } else { if (strstr(prop->value().c_str(),"Constant")) { - _type = TempoSectionType::Constant; + _type = Type::Constant; } else { - _type = TempoSectionType::Ramp; + _type = Type::Ramp; } } } @@ -176,7 +176,7 @@ TempoSection::update_bar_offset_from_bbt (const Meter& m) } void -TempoSection::set_type (TempoSectionType type) +TempoSection::set_type (Type type) { _type = type; } @@ -433,7 +433,7 @@ TempoMap::TempoMap (framecnt_t fr) start.beats = 1; start.ticks = 0; - TempoSection *t = new TempoSection (start, _default_tempo.beats_per_minute(), _default_tempo.note_type(), TempoSection::TempoSectionType::Ramp); + TempoSection *t = new TempoSection (start, _default_tempo.beats_per_minute(), _default_tempo.note_type(), TempoSection::Type::Ramp); MeterSection *m = new MeterSection (start, _default_meter.divisions_per_bar(), _default_meter.note_divisor()); t->set_movable (false); @@ -637,7 +637,7 @@ TempoMap::do_insert (MetricSection* section) } void -TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const BBT_Time& where, TempoSection::TempoSectionType type) +TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const BBT_Time& where, TempoSection::Type type) { { Glib::Threads::RWLock::WriterLock lm (lock); @@ -660,7 +660,7 @@ TempoMap::replace_tempo (const TempoSection& ts, const Tempo& tempo, const BBT_T } void -TempoMap::add_tempo (const Tempo& tempo, BBT_Time where, ARDOUR::TempoSection::TempoSectionType type) +TempoMap::add_tempo (const Tempo& tempo, BBT_Time where, ARDOUR::TempoSection::Type type) { { Glib::Threads::RWLock::WriterLock lm (lock); @@ -672,7 +672,7 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where, ARDOUR::TempoSection::T } void -TempoMap::add_tempo_locked (const Tempo& tempo, BBT_Time where, bool recompute, ARDOUR::TempoSection::TempoSectionType type) +TempoMap::add_tempo_locked (const Tempo& tempo, BBT_Time where, bool recompute, ARDOUR::TempoSection::Type type) { /* new tempos always start on a beat */ where.ticks = 0; @@ -1058,7 +1058,7 @@ TempoMap::_extend_map (TempoSection* tempo, MeterSection* meter, double ticks_relative_to_prev_ts = ticks_at_ts - ticks_at_prev_ts; /* assume (falsely) that the target tempo is constant */ double length_estimate = (ticks_relative_to_prev_ts / BBT_Time::ticks_per_beat) * meter->frames_per_grid (*t, _frame_rate); - if (prev_ts->type() == TempoSection::TempoSectionType::Constant) { + if (prev_ts->type() == TempoSection::Type::Constant) { cerr << "constant type " << endl; length_estimate = (ticks_relative_to_prev_ts / BBT_Time::ticks_per_beat) * prev_ts->frames_per_beat (_frame_rate); } diff --git a/libs/ardour/test/framepos_minus_beats_test.cc b/libs/ardour/test/framepos_minus_beats_test.cc index 7b6941e507..6f1bba53b2 100644 --- a/libs/ardour/test/framepos_minus_beats_test.cc +++ b/libs/ardour/test/framepos_minus_beats_test.cc @@ -23,7 +23,7 @@ FrameposMinusBeatsTest::singleTempoTest () Meter meter (4, 4); map.add_meter (meter, BBT_Time (1, 1, 0)); - map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempo, BBT_Time (1, 1, 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)); @@ -63,9 +63,9 @@ FrameposMinusBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); /* Now some tests */ @@ -115,9 +115,9 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); Meter meterB (3, 4); map.add_meter (meterB, BBT_Time (4, 1, 0)); diff --git a/libs/ardour/test/framepos_plus_beats_test.cc b/libs/ardour/test/framepos_plus_beats_test.cc index 442c9b3d56..425ae84343 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.add_meter (meter, BBT_Time (1, 1, 0)); - map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempo, BBT_Time (1, 1, 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)); @@ -62,9 +62,9 @@ FrameposPlusBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); /* Now some tests */ @@ -114,9 +114,9 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); Meter meterB (3, 4); map.add_meter (meterB, BBT_Time (4, 1, 0)); diff --git a/libs/ardour/test/framewalk_to_beats_test.cc b/libs/ardour/test/framewalk_to_beats_test.cc index 67a9be72c4..84ddf6fc30 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.add_meter (meter, BBT_Time (1, 1, 0)); - map.add_tempo (tempo, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempo, BBT_Time (1, 1, 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(); @@ -70,9 +70,9 @@ FramewalkToBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); /* Now some tests */ @@ -125,11 +125,11 @@ FramewalkToBeatsTest::tripleTempoTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (2, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (2, 1, 0), TempoSection::Type::Constant); Tempo tempoC (160); - map.add_tempo (tempoC, BBT_Time (3, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoC, BBT_Time (3, 1, 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 d5d7a86153..392e2876e9 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, Timecode::BBT_Time(1, 1, 0), TempoSection::TempoSectionType::Constant); + _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)); } diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc index 21bd8eb627..04b24f6d73 100644 --- a/libs/ardour/test/tempo_test.cc +++ b/libs/ardour/test/tempo_test.cc @@ -35,9 +35,9 @@ TempoTest::recomputeMapTest () */ Tempo tempoA (120); - map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoA, BBT_Time (1, 1, 0), TempoSection::Type::Constant); Tempo tempoB (240); - map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::TempoSectionType::Constant); + map.add_tempo (tempoB, BBT_Time (4, 1, 0), TempoSection::Type::Constant); Meter meterB (3, 4); map.add_meter (meterB, BBT_Time (4, 1, 0)); |