From: nick_m Date: Thu, 26 May 2016 15:44:58 +0000 (+1000) Subject: Tempo ramps - rename meter_at() -> meter_at_frame() & make the ticker slightly more... X-Git-Tag: 5.0-pre0~330 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=baf8f379677d6fea53d665aaff1945ccd896a6fe;hp=8f3bc6f8099d7fc3bcc7f0dc88434afa0084e35f;p=ardour.git Tempo ramps - rename meter_at() -> meter_at_frame() & make the ticker slightly more efficient. --- diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 47e91021ae..cf7e10dd8a 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -546,7 +546,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) before_x = line.nth (front()->view_index() - 1)->get_x(); const framepos_t pos = e.pixel_to_sample(before_x); - const Meter& meter = map.meter_at (pos); + const Meter& meter = map.meter_at_frame (pos); const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at_frame (pos), e.session()->frame_rate()) / (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) ); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); @@ -562,7 +562,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e) after_x = line.nth (back()->view_index() + 1)->get_x(); const framepos_t pos = e.pixel_to_sample(after_x); - const Meter& meter = map.meter_at (pos); + const Meter& meter = map.meter_at_frame (pos); const framecnt_t len = ceil (meter.frames_per_bar (map.tempo_at_frame (pos), e.session()->frame_rate()) / (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar())); const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 691292025f..c5d99c69bf 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4105,7 +4105,7 @@ Editor::get_grid_type_as_beats (bool& success, framepos_t position) return Evoral::Beats(1.0); case SnapToBar: if (_session) { - return Evoral::Beats(_session->tempo_map().meter_at (position).divisions_per_bar()); + return Evoral::Beats(_session->tempo_map().meter_at_frame (position).divisions_per_bar()); } break; default: diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 2038c40860..47f2e8cec7 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6476,7 +6476,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end) { framepos_t length = end - start; - const Meter& m (_session->tempo_map().meter_at (start)); + const Meter& m (_session->tempo_map().meter_at_frame (start)); /* length = 1 bar */ diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 3fbe2c83fc..31030988ee 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3229,7 +3229,7 @@ MidiRegionView::nudge_notes (bool forward, bool fine) if (!fine) { /* non-fine, move by 1 bar regardless of snap */ - delta = Evoral::Beats(trackview.session()->tempo_map().meter_at(ref_point).divisions_per_bar()); + delta = Evoral::Beats(trackview.session()->tempo_map().meter_at_frame (ref_point).divisions_per_bar()); } else if (trackview.editor().snap_mode() == Editing::SnapOff) { diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index 62b2646b81..d82f0a2dd7 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -115,7 +115,7 @@ StepEditor::prepare_step_edit_region () } else { - const Meter& m = _mtv.session()->tempo_map().meter_at (step_edit_insert_position); + const Meter& m = _mtv.session()->tempo_map().meter_at_frame (step_edit_insert_position); const Tempo& t = _mtv.session()->tempo_map().tempo_at_frame (step_edit_insert_position); double baf = _mtv.session()->tempo_map().beat_at_frame (step_edit_insert_position); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index b68e82f30b..b4951f35ca 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -422,7 +422,7 @@ MeterDialog::MeterDialog (TempoMap& map, framepos_t frame, const string&) { Timecode::BBT_Time when; frame = map.round_to_bar(frame, RoundNearest); - Meter meter (map.meter_at(frame)); + Meter meter (map.meter_at_frame (frame)); map.bbt_time (frame, when); init (when, meter.divisions_per_bar(), meter.note_divisor(), true, MusicTime); diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index 84d75d2451..aac476408d 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -137,7 +137,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end) Timecode::Time timecode; Timecode::BBT_Time sbbt; Timecode::BBT_Time ebbt; - Meter meter_at_start (_editor->_session->tempo_map().meter_at(start)); + Meter meter_at_start (_editor->_session->tempo_map().meter_at_frame (start)); if (_editor->_session == 0) { return; diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 52caaf5030..f08ffa64b9 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -332,8 +332,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible double frames_per_beat_at (const framepos_t&, const framecnt_t& sr) const; - const Meter& meter_at (framepos_t) const; - const TempoSection& tempo_section_at (framepos_t frame) const; const MeterSection& meter_section_at (framepos_t frame) const; const MeterSection& meter_section_at_beat (double beat) const; @@ -417,6 +415,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible framecnt_t frame_at_pulse (const double& pulse) const; const Tempo tempo_at_frame (const framepos_t& frame) const; + const Meter& meter_at_frame (framepos_t) const; double beat_at_bbt (const Timecode::BBT_Time& bbt); Timecode::BBT_Time bbt_at_beat (const double& beats); diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index fcb840c0ed..36ac3a8203 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -3023,7 +3023,7 @@ TempoMap::meter_section_at_beat (double beat) const } const Meter& -TempoMap::meter_at (framepos_t frame) const +TempoMap::meter_at_frame (framepos_t frame) const { TempoMetric m (metric_at (frame)); return m.meter(); diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index 58a1c4573d..def219a433 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -68,9 +68,10 @@ public: s->bbt_time (this->frame, *this); const TempoMap& tempo = s->tempo_map(); + const Meter& meter = tempo.meter_at_frame (frame); - const double divisions = tempo.meter_at(frame).divisions_per_bar(); - const double divisor = tempo.meter_at(frame).note_divisor(); + const double divisions = meter.divisions_per_bar(); + const double divisor = meter.note_divisor(); const double qnote_scale = divisor * 0.25f; double mb;