From: nick_m Date: Tue, 30 Aug 2016 20:57:46 +0000 (+1000) Subject: Fix incorrect inclusion of note_type in Tempo::pulses_per_minute(). X-Git-Tag: 5.4~357 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=e82482e8e9c;p=ardour.git Fix incorrect inclusion of note_type in Tempo::pulses_per_minute(). --- diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index ab52e8e839..ebc02284db 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -62,7 +62,7 @@ class LIBARDOUR_API Tempo { double beats_per_minute () const { return _beats_per_minute; } void set_beats_per_minute (double bpm) { _beats_per_minute = bpm; } double note_type () const { return _note_type; } - double pulses_per_minute () const { return _beats_per_minute / _note_type; } + double pulses_per_minute () const { return _beats_per_minute / 4.0; } /** audio samples per beat * @param sr samplerate */ diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 3229f8c7ba..2dad0bb354 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1560,7 +1560,7 @@ TempoMap::tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame } 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 double ret_bpm = prev_t->tempo_at_frame (frame, _frame_rate) * 4.0; const Tempo ret_tempo (ret_bpm, prev_t->note_type()); return ret_tempo; } @@ -1591,7 +1591,7 @@ 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(); + const double tempo_ppm = tempo.beats_per_minute() / 4.0; Metrics::const_iterator i; @@ -1604,14 +1604,14 @@ TempoMap::frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) con continue; } - const double t_ppm = t->beats_per_minute() / t->note_type(); + const double t_ppm = t->beats_per_minute() / 4.0; 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(); + const double prev_t_ppm = prev_t->beats_per_minute() / 4.0; if ((t_ppm > tempo_ppm && prev_t_ppm < tempo_ppm) || (t_ppm < tempo_ppm && prev_t_ppm > tempo_ppm)) { return prev_t->frame_at_tempo (tempo_ppm, prev_t->pulse(), _frame_rate); @@ -1635,7 +1635,7 @@ TempoMap::tempo_at_beat (const double& beat) const const TempoSection* prev_t = &tempo_section_at_beat_locked (_metrics, beat); const double note_type = prev_t->note_type(); - return Tempo (prev_t->tempo_at_pulse (((beat - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse()) * note_type, note_type); + return Tempo (prev_t->tempo_at_pulse (((beat - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse()) * 4.0, note_type); } double @@ -3567,7 +3567,7 @@ TempoMap::frames_per_beat_at (const framepos_t& frame, const framecnt_t& sr) con } if (ts_after) { - return (60.0 * _frame_rate) / (ts_at->tempo_at_frame (frame, _frame_rate) * ts_at->note_type()); + return (60.0 * _frame_rate) / (ts_at->tempo_at_frame (frame, _frame_rate) * 4.0); } /* must be treated as constant tempo */ return ts_at->frames_per_beat (_frame_rate);