Tempo ramps - rename meter_at() -> meter_at_frame() & make the ticker slightly more efficient.

This commit is contained in:
nick_m 2016-05-27 01:44:58 +10:00
parent 8f3bc6f809
commit baf8f37967
10 changed files with 13 additions and 13 deletions

View File

@ -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);

View File

@ -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:

View File

@ -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 */

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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;