mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
Tempo ramps - rename meter/tempo_section_at() -> meter/tempo_section_at_frame()
This commit is contained in:
parent
1d85229500
commit
aad7b129b6
5 changed files with 126 additions and 144 deletions
|
|
@ -3417,7 +3417,7 @@ BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
||||||
TempoMap& map (_editor->session()->tempo_map());
|
TempoMap& map (_editor->session()->tempo_map());
|
||||||
ostringstream sstr;
|
ostringstream sstr;
|
||||||
|
|
||||||
_tempo = const_cast<TempoSection*> (&map.tempo_section_at (raw_grab_frame()));
|
_tempo = const_cast<TempoSection*> (&map.tempo_section_at_frame (raw_grab_frame()));
|
||||||
sstr << "^" << fixed << setprecision(3) << map.tempo_at_frame (adjusted_current_frame (event)).beats_per_minute() << "\n";
|
sstr << "^" << fixed << setprecision(3) << map.tempo_at_frame (adjusted_current_frame (event)).beats_per_minute() << "\n";
|
||||||
sstr << "<" << fixed << setprecision(3) << _tempo->beats_per_minute();
|
sstr << "<" << fixed << setprecision(3) << _tempo->beats_per_minute();
|
||||||
show_verbose_cursor_text (sstr.str());
|
show_verbose_cursor_text (sstr.str());
|
||||||
|
|
|
||||||
|
|
@ -6501,7 +6501,7 @@ Editor::define_one_bar (framepos_t start, framepos_t end)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TempoSection& t (_session->tempo_map().tempo_section_at (start));
|
const TempoSection& t (_session->tempo_map().tempo_section_at_frame (start));
|
||||||
|
|
||||||
bool do_global = false;
|
bool do_global = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ void
|
||||||
MainClock::edit_current_tempo ()
|
MainClock::edit_current_tempo ()
|
||||||
{
|
{
|
||||||
if (!PublicEditor::instance().session()) return;
|
if (!PublicEditor::instance().session()) return;
|
||||||
ARDOUR::TempoSection ts = PublicEditor::instance().session()->tempo_map().tempo_section_at (absolute_time());
|
ARDOUR::TempoSection ts = PublicEditor::instance().session()->tempo_map().tempo_section_at_frame (absolute_time());
|
||||||
PublicEditor::instance().edit_tempo_section (&ts);
|
PublicEditor::instance().edit_tempo_section (&ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ void
|
||||||
MainClock::edit_current_meter ()
|
MainClock::edit_current_meter ()
|
||||||
{
|
{
|
||||||
if (!PublicEditor::instance().session()) return;
|
if (!PublicEditor::instance().session()) return;
|
||||||
ARDOUR::MeterSection ms = PublicEditor::instance().session()->tempo_map().meter_section_at (absolute_time());
|
ARDOUR::MeterSection ms = PublicEditor::instance().session()->tempo_map().meter_section_at_frame (absolute_time());
|
||||||
PublicEditor::instance().edit_meter_section (&ms);
|
PublicEditor::instance().edit_meter_section (&ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -333,8 +333,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
/* because tempos may be ramped, this is only valid for the instant requested.*/
|
/* because tempos may be ramped, this is only valid for the instant requested.*/
|
||||||
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 TempoSection& tempo_section_at (framepos_t frame) const;
|
const TempoSection& tempo_section_at_frame (framepos_t frame) const;
|
||||||
const MeterSection& meter_section_at (framepos_t frame) const;
|
const MeterSection& meter_section_at_frame (framepos_t frame) const;
|
||||||
const MeterSection& meter_section_at_beat (double beat) const;
|
const MeterSection& meter_section_at_beat (double beat) const;
|
||||||
|
|
||||||
/** add a tempo section locked to pls. ignored values will be set in recompute_tempos()
|
/** add a tempo section locked to pls. ignored values will be set in recompute_tempos()
|
||||||
|
|
@ -406,17 +406,19 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
double beat_at_frame (const framecnt_t& frame) const;
|
double beat_at_frame (const framecnt_t& frame) const;
|
||||||
framecnt_t frame_at_beat (const double& beat) const;
|
framecnt_t frame_at_beat (const double& beat) const;
|
||||||
|
|
||||||
|
Tempo tempo_at_frame (const framepos_t& frame) const;
|
||||||
|
framepos_t frame_at_tempo (const Tempo& tempo) const;
|
||||||
|
|
||||||
|
const Meter& meter_at_frame (framepos_t) const;
|
||||||
|
|
||||||
|
/* you probably only need to use pulses when moving tempos */
|
||||||
double pulse_at_beat (const double& beat) const;
|
double pulse_at_beat (const double& beat) const;
|
||||||
double beat_at_pulse (const double& pulse) const;
|
double beat_at_pulse (const double& pulse) const;
|
||||||
|
|
||||||
double pulse_at_frame (const framecnt_t& frame) const;
|
double pulse_at_frame (const framecnt_t& frame) const;
|
||||||
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;
|
/* bbt - it's nearly always better to use beats.*/
|
||||||
framepos_t frame_at_tempo (const Tempo& tempo) const;
|
|
||||||
|
|
||||||
const Meter& meter_at_frame (framepos_t) const;
|
|
||||||
|
|
||||||
Timecode::BBT_Time bbt_at_frame (framepos_t when);
|
Timecode::BBT_Time bbt_at_frame (framepos_t when);
|
||||||
framepos_t frame_at_bbt (const Timecode::BBT_Time&);
|
framepos_t frame_at_bbt (const Timecode::BBT_Time&);
|
||||||
|
|
||||||
|
|
@ -426,8 +428,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
double pulse_at_bbt (const Timecode::BBT_Time& bbt);
|
double pulse_at_bbt (const Timecode::BBT_Time& bbt);
|
||||||
Timecode::BBT_Time bbt_at_pulse (const double& pulse);
|
Timecode::BBT_Time bbt_at_pulse (const double& pulse);
|
||||||
|
|
||||||
std::pair<double, framepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
|
|
||||||
|
|
||||||
framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time&, int dir);
|
framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time&, int dir);
|
||||||
|
|
||||||
/* TEMPO-SENSITIVE FUNCTIONS
|
/* TEMPO-SENSITIVE FUNCTIONS
|
||||||
|
|
@ -445,6 +445,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
framepos_t framepos_minus_beats (framepos_t, Evoral::Beats) const;
|
framepos_t framepos_minus_beats (framepos_t, Evoral::Beats) const;
|
||||||
Evoral::Beats framewalk_to_beats (framepos_t pos, framecnt_t distance) const;
|
Evoral::Beats framewalk_to_beats (framepos_t pos, framecnt_t distance) const;
|
||||||
|
|
||||||
|
std::pair<double, framepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
|
||||||
void gui_move_tempo (TempoSection*, const framepos_t& frame);
|
void gui_move_tempo (TempoSection*, const framepos_t& frame);
|
||||||
void gui_move_meter (MeterSection*, const framepos_t& frame);
|
void gui_move_meter (MeterSection*, const framepos_t& frame);
|
||||||
bool gui_change_tempo (TempoSection*, const Tempo& bpm);
|
bool gui_change_tempo (TempoSection*, const Tempo& bpm);
|
||||||
|
|
@ -456,14 +457,21 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
void fix_legacy_session();
|
void fix_legacy_session();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
double beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
|
||||||
|
framecnt_t frame_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
||||||
|
|
||||||
double pulse_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
double pulse_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
||||||
double beat_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
double beat_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
||||||
|
|
||||||
double pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
|
double pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
|
||||||
framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
||||||
|
|
||||||
double beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
|
Tempo tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
|
||||||
framecnt_t frame_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
framepos_t frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) const;
|
||||||
|
|
||||||
|
Timecode::BBT_Time bbt_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
|
||||||
|
framepos_t frame_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&) const;
|
||||||
|
|
||||||
double beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const ;
|
double beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const ;
|
||||||
Timecode::BBT_Time bbt_at_beat_locked (const Metrics& metrics, const double& beats) const;
|
Timecode::BBT_Time bbt_at_beat_locked (const Metrics& metrics, const double& beats) const;
|
||||||
|
|
@ -471,17 +479,10 @@ private:
|
||||||
double pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const;
|
double pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const;
|
||||||
Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
||||||
|
|
||||||
Timecode::BBT_Time bbt_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
|
const TempoSection& tempo_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const;
|
||||||
framepos_t frame_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&) const;
|
|
||||||
|
|
||||||
const Tempo tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
|
|
||||||
framepos_t frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) const;
|
|
||||||
|
|
||||||
const TempoSection& tempo_section_at_locked (const Metrics& metrics, framepos_t frame) const;
|
|
||||||
const TempoSection& tempo_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
const TempoSection& tempo_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
||||||
const TempoSection& tempo_section_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
|
|
||||||
|
|
||||||
const MeterSection& meter_section_at_locked (const Metrics& metrics, framepos_t frame) const;
|
const MeterSection& meter_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const;
|
||||||
const MeterSection& meter_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
const MeterSection& meter_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
|
||||||
|
|
||||||
bool check_solved (const Metrics& metrics) const;
|
bool check_solved (const Metrics& metrics) const;
|
||||||
|
|
|
||||||
|
|
@ -1009,7 +1009,7 @@ TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_T
|
||||||
MeterSection*
|
MeterSection*
|
||||||
TempoMap::add_meter_locked (const Meter& meter, double beat, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls, bool recompute)
|
TempoMap::add_meter_locked (const Meter& meter, double beat, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls, bool recompute)
|
||||||
{
|
{
|
||||||
const MeterSection& prev_m = meter_section_at_locked (_metrics, frame - 1);
|
const MeterSection& prev_m = meter_section_at_frame_locked (_metrics, frame - 1);
|
||||||
const double pulse = ((where.bars - prev_m.bbt().bars) * (prev_m.divisions_per_bar() / prev_m.note_divisor())) + prev_m.pulse();
|
const double pulse = ((where.bars - prev_m.bbt().bars) * (prev_m.divisions_per_bar() / prev_m.note_divisor())) + prev_m.pulse();
|
||||||
|
|
||||||
if (pls == AudioTime) {
|
if (pls == AudioTime) {
|
||||||
|
|
@ -1396,7 +1396,7 @@ TempoMap::beat_at_frame (const framecnt_t& frame) const
|
||||||
double
|
double
|
||||||
TempoMap::beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const
|
TempoMap::beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const
|
||||||
{
|
{
|
||||||
const TempoSection& ts = tempo_section_at_locked (metrics, frame);
|
const TempoSection& ts = tempo_section_at_frame_locked (metrics, frame);
|
||||||
MeterSection* prev_m = 0;
|
MeterSection* prev_m = 0;
|
||||||
MeterSection* next_m = 0;
|
MeterSection* next_m = 0;
|
||||||
|
|
||||||
|
|
@ -1449,6 +1449,92 @@ TempoMap::frame_at_beat_locked (const Metrics& metrics, const double& beat) cons
|
||||||
return prev_t.frame_at_pulse (((beat - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse(), _frame_rate);
|
return prev_t.frame_at_pulse (((beat - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse(), _frame_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tempo
|
||||||
|
TempoMap::tempo_at_frame (const framepos_t& frame) const
|
||||||
|
{
|
||||||
|
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||||
|
return tempo_at_frame_locked (_metrics, frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tempo
|
||||||
|
TempoMap::tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const
|
||||||
|
{
|
||||||
|
TempoSection* prev_t = 0;
|
||||||
|
|
||||||
|
Metrics::const_iterator i;
|
||||||
|
|
||||||
|
for (i = _metrics.begin(); i != _metrics.end(); ++i) {
|
||||||
|
TempoSection* t;
|
||||||
|
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
|
||||||
|
if (!t->active()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((prev_t) && t->frame() > frame) {
|
||||||
|
/* t is the section past frame */
|
||||||
|
const double ret_bpm = prev_t->tempo_at_frame (frame, _frame_rate) * prev_t->note_type();
|
||||||
|
const Tempo ret_tempo (ret_bpm, prev_t->note_type());
|
||||||
|
return ret_tempo;
|
||||||
|
}
|
||||||
|
prev_t = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const double ret = prev_t->beats_per_minute();
|
||||||
|
const Tempo ret_tempo (ret, prev_t->note_type ());
|
||||||
|
|
||||||
|
return ret_tempo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** returns the frame at which the supplied tempo occurs, or
|
||||||
|
* the frame of the last tempo section (search exhausted)
|
||||||
|
* only the position of the first occurence will be returned
|
||||||
|
* (extend me)
|
||||||
|
*/
|
||||||
|
framepos_t
|
||||||
|
TempoMap::frame_at_tempo (const Tempo& tempo) const
|
||||||
|
{
|
||||||
|
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||||
|
return frame_at_tempo_locked (_metrics, tempo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
framepos_t
|
||||||
|
TempoMap::frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) const
|
||||||
|
{
|
||||||
|
TempoSection* prev_t = 0;
|
||||||
|
const double tempo_ppm = tempo.beats_per_minute() / tempo.note_type();
|
||||||
|
|
||||||
|
Metrics::const_iterator i;
|
||||||
|
|
||||||
|
for (i = _metrics.begin(); i != _metrics.end(); ++i) {
|
||||||
|
TempoSection* t;
|
||||||
|
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
|
||||||
|
|
||||||
|
if (!t->active()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const double t_ppm = t->beats_per_minute() / t->note_type();
|
||||||
|
|
||||||
|
if (t_ppm == tempo_ppm) {
|
||||||
|
return t->frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prev_t) {
|
||||||
|
const double prev_t_ppm = prev_t->beats_per_minute() / prev_t->note_type();
|
||||||
|
|
||||||
|
if ((t_ppm > tempo_ppm && prev_t_ppm < tempo_ppm) || (t_ppm < tempo_ppm && prev_t_ppm > tempo_ppm)) {
|
||||||
|
const framepos_t ret_frame = prev_t->frame_at_tempo (tempo_ppm, prev_t->pulse(), _frame_rate);
|
||||||
|
return ret_frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prev_t = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return prev_t->frame();
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
TempoMap::pulse_at_beat (const double& beat) const
|
TempoMap::pulse_at_beat (const double& beat) const
|
||||||
{
|
{
|
||||||
|
|
@ -1576,93 +1662,6 @@ TempoMap::frame_at_pulse_locked (const Metrics& metrics, const double& pulse) co
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Tempo
|
|
||||||
TempoMap::tempo_at_frame (const framepos_t& frame) const
|
|
||||||
{
|
|
||||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
|
||||||
return tempo_at_frame_locked (_metrics, frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Tempo
|
|
||||||
TempoMap::tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const
|
|
||||||
{
|
|
||||||
TempoSection* prev_t = 0;
|
|
||||||
|
|
||||||
Metrics::const_iterator i;
|
|
||||||
|
|
||||||
for (i = _metrics.begin(); i != _metrics.end(); ++i) {
|
|
||||||
TempoSection* t;
|
|
||||||
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
|
|
||||||
if (!t->active()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((prev_t) && t->frame() > frame) {
|
|
||||||
/* t is the section past frame */
|
|
||||||
const double ret_bpm = prev_t->tempo_at_frame (frame, _frame_rate) * prev_t->note_type();
|
|
||||||
const Tempo ret_tempo (ret_bpm, prev_t->note_type());
|
|
||||||
return ret_tempo;
|
|
||||||
}
|
|
||||||
prev_t = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const double ret = prev_t->beats_per_minute();
|
|
||||||
const Tempo ret_tempo (ret, prev_t->note_type ());
|
|
||||||
|
|
||||||
return ret_tempo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** returns the frame at which the supplied tempo occurs, or
|
|
||||||
* the frame of the last tempo section (search exhausted)
|
|
||||||
* only the position of the first occurence will be returned
|
|
||||||
* (extend me)
|
|
||||||
*/
|
|
||||||
framepos_t
|
|
||||||
TempoMap::frame_at_tempo (const Tempo& tempo) const
|
|
||||||
{
|
|
||||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
|
||||||
return frame_at_tempo_locked (_metrics, tempo);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
framepos_t
|
|
||||||
TempoMap::frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) const
|
|
||||||
{
|
|
||||||
TempoSection* prev_t = 0;
|
|
||||||
const double tempo_ppm = tempo.beats_per_minute() / tempo.note_type();
|
|
||||||
|
|
||||||
Metrics::const_iterator i;
|
|
||||||
|
|
||||||
for (i = _metrics.begin(); i != _metrics.end(); ++i) {
|
|
||||||
TempoSection* t;
|
|
||||||
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
|
|
||||||
|
|
||||||
if (!t->active()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const double t_ppm = t->beats_per_minute() / t->note_type();
|
|
||||||
|
|
||||||
if (t_ppm == tempo_ppm) {
|
|
||||||
return t->frame();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (prev_t) {
|
|
||||||
const double prev_t_ppm = prev_t->beats_per_minute() / prev_t->note_type();
|
|
||||||
|
|
||||||
if ((t_ppm > tempo_ppm && prev_t_ppm < tempo_ppm) || (t_ppm < tempo_ppm && prev_t_ppm > tempo_ppm)) {
|
|
||||||
const framepos_t ret_frame = prev_t->frame_at_tempo (tempo_ppm, prev_t->pulse(), _frame_rate);
|
|
||||||
return ret_frame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prev_t = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return prev_t->frame();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double
|
double
|
||||||
TempoMap::beat_at_bbt (const Timecode::BBT_Time& bbt)
|
TempoMap::beat_at_bbt (const Timecode::BBT_Time& bbt)
|
||||||
{
|
{
|
||||||
|
|
@ -1943,7 +1942,7 @@ TempoMap::check_solved (const Metrics& metrics) const
|
||||||
|
|
||||||
if ((m = dynamic_cast<MeterSection*> (*i)) != 0) {
|
if ((m = dynamic_cast<MeterSection*> (*i)) != 0) {
|
||||||
if (prev_m && m->position_lock_style() == AudioTime) {
|
if (prev_m && m->position_lock_style() == AudioTime) {
|
||||||
TempoSection* t = const_cast<TempoSection*>(&tempo_section_at_locked (metrics, m->frame() - 1));
|
TempoSection* t = const_cast<TempoSection*>(&tempo_section_at_frame_locked (metrics, m->frame() - 1));
|
||||||
const double nascent_m_pulse = ((m->beat() - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse();
|
const double nascent_m_pulse = ((m->beat() - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse();
|
||||||
const framepos_t nascent_m_frame = t->frame_at_pulse (nascent_m_pulse, _frame_rate);
|
const framepos_t nascent_m_frame = t->frame_at_pulse (nascent_m_pulse, _frame_rate);
|
||||||
|
|
||||||
|
|
@ -2131,7 +2130,7 @@ bool
|
||||||
TempoMap::solve_map_frame (Metrics& imaginary, MeterSection* section, const framepos_t& frame)
|
TempoMap::solve_map_frame (Metrics& imaginary, MeterSection* section, const framepos_t& frame)
|
||||||
{
|
{
|
||||||
/* disallow moving first meter past any subsequent one, and any movable meter before the first one */
|
/* disallow moving first meter past any subsequent one, and any movable meter before the first one */
|
||||||
const MeterSection* other = &meter_section_at_locked (imaginary, frame);
|
const MeterSection* other = &meter_section_at_frame_locked (imaginary, frame);
|
||||||
if ((!section->movable() && other->movable()) || (!other->movable() && section->movable() && other->frame() >= frame)) {
|
if ((!section->movable() && other->movable()) || (!other->movable() && section->movable() && other->frame() >= frame)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2201,7 +2200,7 @@ TempoMap::solve_map_frame (Metrics& imaginary, MeterSection* section, const fram
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* all is ok. set section's tempo */
|
/* all is ok. set section's tempo */
|
||||||
MeterSection* meter_copy = const_cast<MeterSection*> (&meter_section_at_locked (future_map, section->frame()));
|
MeterSection* meter_copy = const_cast<MeterSection*> (&meter_section_at_frame_locked (future_map, section->frame()));
|
||||||
meter_copy->set_frame (frame);
|
meter_copy->set_frame (frame);
|
||||||
|
|
||||||
if ((solved = solve_map_frame (future_map, tempo_copy, frame))) {
|
if ((solved = solve_map_frame (future_map, tempo_copy, frame))) {
|
||||||
|
|
@ -2635,7 +2634,7 @@ TempoMap::gui_dilate_tempo (TempoSection* ts, const framepos_t& frame, const fra
|
||||||
const frameoffset_t fr_off = end_frame - frame;
|
const frameoffset_t fr_off = end_frame - frame;
|
||||||
|
|
||||||
if (prev_t && prev_t->pulse() > 0.0) {
|
if (prev_t && prev_t->pulse() > 0.0) {
|
||||||
prev_to_prev_t = const_cast<TempoSection*>(&tempo_section_at_locked (future_map, prev_t->frame() - 1));
|
prev_to_prev_t = const_cast<TempoSection*>(&tempo_section_at_frame_locked (future_map, prev_t->frame() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TempoSection* next_t = 0;
|
TempoSection* next_t = 0;
|
||||||
|
|
@ -2920,8 +2919,8 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
|
||||||
}
|
}
|
||||||
while (pos < upper) {
|
while (pos < upper) {
|
||||||
pos = frame_at_beat_locked (_metrics, cnt);
|
pos = frame_at_beat_locked (_metrics, cnt);
|
||||||
const TempoSection tempo = tempo_section_at_locked (_metrics, pos);
|
const TempoSection tempo = tempo_section_at_frame_locked (_metrics, pos);
|
||||||
const MeterSection meter = meter_section_at_locked (_metrics, pos);
|
const MeterSection meter = meter_section_at_frame_locked (_metrics, pos);
|
||||||
const BBT_Time bbt = bbt_at_beat_locked (_metrics, cnt);
|
const BBT_Time bbt = bbt_at_beat_locked (_metrics, cnt);
|
||||||
points.push_back (BBTPoint (meter, tempo_at_frame_locked (_metrics, pos), pos, bbt.bars, bbt.beats, tempo.c_func()));
|
points.push_back (BBTPoint (meter, tempo_at_frame_locked (_metrics, pos), pos, bbt.bars, bbt.beats, tempo.c_func()));
|
||||||
++cnt;
|
++cnt;
|
||||||
|
|
@ -2929,14 +2928,14 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
|
||||||
}
|
}
|
||||||
|
|
||||||
const TempoSection&
|
const TempoSection&
|
||||||
TempoMap::tempo_section_at (framepos_t frame) const
|
TempoMap::tempo_section_at_frame (framepos_t frame) const
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||||
return tempo_section_at_locked (_metrics, frame);
|
return tempo_section_at_frame_locked (_metrics, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TempoSection&
|
const TempoSection&
|
||||||
TempoMap::tempo_section_at_locked (const Metrics& metrics, framepos_t frame) const
|
TempoMap::tempo_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const
|
||||||
{
|
{
|
||||||
Metrics::const_iterator i;
|
Metrics::const_iterator i;
|
||||||
TempoSection* prev = 0;
|
TempoSection* prev = 0;
|
||||||
|
|
@ -2983,24 +2982,6 @@ TempoMap::tempo_section_at_beat_locked (const Metrics& metrics, const double& be
|
||||||
return *prev_t;
|
return *prev_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TempoSection&
|
|
||||||
TempoMap::tempo_section_at_pulse_locked (const Metrics& metrics, const double& pulse) const
|
|
||||||
{
|
|
||||||
TempoSection* prev_t = 0;
|
|
||||||
|
|
||||||
for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
|
|
||||||
TempoSection* t;
|
|
||||||
if ((t = dynamic_cast<TempoSection*> (*i)) != 0) {
|
|
||||||
if (prev_t && t->pulse() > pulse) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prev_t = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return *prev_t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* don't use this to calculate length (the tempo is only correct for this frame).
|
/* don't use this to calculate length (the tempo is only correct for this frame).
|
||||||
do that stuff based on the beat_at_frame and frame_at_beat api
|
do that stuff based on the beat_at_frame and frame_at_beat api
|
||||||
*/
|
*/
|
||||||
|
|
@ -3009,7 +2990,7 @@ TempoMap::frames_per_beat_at (const framepos_t& frame, const framecnt_t& sr) con
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||||
|
|
||||||
const TempoSection* ts_at = &tempo_section_at_locked (_metrics, frame);
|
const TempoSection* ts_at = &tempo_section_at_frame_locked (_metrics, frame);
|
||||||
const TempoSection* ts_after = 0;
|
const TempoSection* ts_after = 0;
|
||||||
Metrics::const_iterator i;
|
Metrics::const_iterator i;
|
||||||
|
|
||||||
|
|
@ -3035,7 +3016,7 @@ TempoMap::frames_per_beat_at (const framepos_t& frame, const framecnt_t& sr) con
|
||||||
}
|
}
|
||||||
|
|
||||||
const MeterSection&
|
const MeterSection&
|
||||||
TempoMap::meter_section_at_locked (const Metrics& metrics, framepos_t frame) const
|
TempoMap::meter_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const
|
||||||
{
|
{
|
||||||
Metrics::const_iterator i;
|
Metrics::const_iterator i;
|
||||||
MeterSection* prev = 0;
|
MeterSection* prev = 0;
|
||||||
|
|
@ -3063,10 +3044,10 @@ TempoMap::meter_section_at_locked (const Metrics& metrics, framepos_t frame) con
|
||||||
|
|
||||||
|
|
||||||
const MeterSection&
|
const MeterSection&
|
||||||
TempoMap::meter_section_at (framepos_t frame) const
|
TempoMap::meter_section_at_frame (framepos_t frame) const
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||||
return meter_section_at_locked (_metrics, frame);
|
return meter_section_at_frame_locked (_metrics, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MeterSection&
|
const MeterSection&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue