mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
Tempo ramps - rename meter_at() -> meter_at_frame() & make the ticker slightly more efficient.
This commit is contained in:
parent
8f3bc6f809
commit
baf8f37967
10 changed files with 13 additions and 13 deletions
|
|
@ -546,7 +546,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e)
|
||||||
before_x = line.nth (front()->view_index() - 1)->get_x();
|
before_x = line.nth (front()->view_index() - 1)->get_x();
|
||||||
|
|
||||||
const framepos_t pos = e.pixel_to_sample(before_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())
|
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()) );
|
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) );
|
||||||
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
|
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();
|
after_x = line.nth (back()->view_index() + 1)->get_x();
|
||||||
|
|
||||||
const framepos_t pos = e.pixel_to_sample(after_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())
|
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()));
|
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()));
|
||||||
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
|
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
|
||||||
|
|
|
||||||
|
|
@ -4105,7 +4105,7 @@ Editor::get_grid_type_as_beats (bool& success, framepos_t position)
|
||||||
return Evoral::Beats(1.0);
|
return Evoral::Beats(1.0);
|
||||||
case SnapToBar:
|
case SnapToBar:
|
||||||
if (_session) {
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -6476,7 +6476,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end)
|
||||||
{
|
{
|
||||||
framepos_t length = end - start;
|
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 */
|
/* length = 1 bar */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3229,7 +3229,7 @@ MidiRegionView::nudge_notes (bool forward, bool fine)
|
||||||
if (!fine) {
|
if (!fine) {
|
||||||
|
|
||||||
/* non-fine, move by 1 bar regardless of snap */
|
/* 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) {
|
} else if (trackview.editor().snap_mode() == Editing::SnapOff) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ StepEditor::prepare_step_edit_region ()
|
||||||
|
|
||||||
} else {
|
} 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);
|
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);
|
double baf = _mtv.session()->tempo_map().beat_at_frame (step_edit_insert_position);
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ MeterDialog::MeterDialog (TempoMap& map, framepos_t frame, const string&)
|
||||||
{
|
{
|
||||||
Timecode::BBT_Time when;
|
Timecode::BBT_Time when;
|
||||||
frame = map.round_to_bar(frame, RoundNearest);
|
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);
|
map.bbt_time (frame, when);
|
||||||
init (when, meter.divisions_per_bar(), meter.note_divisor(), true, MusicTime);
|
init (when, meter.divisions_per_bar(), meter.note_divisor(), true, MusicTime);
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end)
|
||||||
Timecode::Time timecode;
|
Timecode::Time timecode;
|
||||||
Timecode::BBT_Time sbbt;
|
Timecode::BBT_Time sbbt;
|
||||||
Timecode::BBT_Time ebbt;
|
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) {
|
if (_editor->_session == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -332,8 +332,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
|
|
||||||
double frames_per_beat_at (const framepos_t&, const framecnt_t& sr) const;
|
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 TempoSection& tempo_section_at (framepos_t frame) const;
|
||||||
const MeterSection& meter_section_at (framepos_t frame) const;
|
const MeterSection& meter_section_at (framepos_t frame) const;
|
||||||
const MeterSection& meter_section_at_beat (double beat) 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;
|
framecnt_t frame_at_pulse (const double& pulse) const;
|
||||||
|
|
||||||
const Tempo tempo_at_frame (const framepos_t& frame) 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);
|
double beat_at_bbt (const Timecode::BBT_Time& bbt);
|
||||||
Timecode::BBT_Time bbt_at_beat (const double& beats);
|
Timecode::BBT_Time bbt_at_beat (const double& beats);
|
||||||
|
|
|
||||||
|
|
@ -3023,7 +3023,7 @@ TempoMap::meter_section_at_beat (double beat) const
|
||||||
}
|
}
|
||||||
|
|
||||||
const Meter&
|
const Meter&
|
||||||
TempoMap::meter_at (framepos_t frame) const
|
TempoMap::meter_at_frame (framepos_t frame) const
|
||||||
{
|
{
|
||||||
TempoMetric m (metric_at (frame));
|
TempoMetric m (metric_at (frame));
|
||||||
return m.meter();
|
return m.meter();
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,10 @@ public:
|
||||||
s->bbt_time (this->frame, *this);
|
s->bbt_time (this->frame, *this);
|
||||||
|
|
||||||
const TempoMap& tempo = s->tempo_map();
|
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 divisions = meter.divisions_per_bar();
|
||||||
const double divisor = tempo.meter_at(frame).note_divisor();
|
const double divisor = meter.note_divisor();
|
||||||
const double qnote_scale = divisor * 0.25f;
|
const double qnote_scale = divisor * 0.25f;
|
||||||
double mb;
|
double mb;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue