diff options
author | nick_m <mainsbridge@gmail.com> | 2016-12-16 02:15:56 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-12-16 02:15:56 +1100 |
commit | 9add5ed48060f3d1a445b49494be3b2c07183018 (patch) | |
tree | dc27af4207292ee050ad9f343c687048b39f8279 /libs/ardour/tempo.cc | |
parent | 9afe719827ca46d25833b842d9605b6e4db5c7f3 (diff) |
tempo before the initial section is always constant.
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r-- | libs/ardour/tempo.cc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 0390ee33c0..0208ca3ce3 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -220,8 +220,8 @@ TempoSection::set_type (Type type) Tempo TempoSection::tempo_at_minute (const double& m) const { - - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && m < minute()); + if (constant) { return Tempo (note_types_per_minute(), note_type()); } @@ -246,7 +246,8 @@ TempoSection::tempo_at_minute (const double& m) const double TempoSection::minute_at_ntpm (const double& ntpm, const double& p) const { - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && p < pulse()); + if (constant) { return ((p - pulse()) / pulses_per_minute()) + minute(); } @@ -258,8 +259,9 @@ TempoSection::minute_at_ntpm (const double& ntpm, const double& p) const Tempo TempoSection::tempo_at_pulse (const double& p) const { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && p < pulse()); - if (_type == Constant || _c_func == 0.0) { + if (constant) { return Tempo (note_types_per_minute(), note_type()); } @@ -279,7 +281,8 @@ TempoSection::tempo_at_pulse (const double& p) const double TempoSection::pulse_at_ntpm (const double& ntpm, const double& m) const { - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && m < minute()); + if (constant) { return ((m - minute()) * pulses_per_minute()) + pulse(); } @@ -291,7 +294,8 @@ TempoSection::pulse_at_ntpm (const double& ntpm, const double& m) const double TempoSection::pulse_at_minute (const double& m) const { - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && m < minute()); + if (constant) { return ((m - minute()) * pulses_per_minute()) + pulse(); } @@ -303,7 +307,8 @@ TempoSection::pulse_at_minute (const double& m) const double TempoSection::minute_at_pulse (const double& p) const { - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && p < pulse()); + if (constant) { return ((p - pulse()) / pulses_per_minute()) + minute(); } @@ -319,7 +324,8 @@ TempoSection::minute_at_pulse (const double& p) const double TempoSection::pulse_at_frame (const framepos_t& f) const { - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && f < frame()); + if (constant) { return (minute_at_frame (f - frame()) * pulses_per_minute()) + pulse(); } @@ -329,7 +335,8 @@ TempoSection::pulse_at_frame (const framepos_t& f) const framepos_t TempoSection::frame_at_pulse (const double& p) const { - if (_type == Constant || _c_func == 0.0) { + const bool constant = _type == Constant || _c_func == 0.0 || (initial() && p < pulse()); + if (constant) { return frame_at_minute (((p - pulse()) / pulses_per_minute()) + minute()); } |