diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 52c4d04b82..08c2eec4dd 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -394,7 +394,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible /* TEMPO- AND METER-SENSITIVE FUNCTIONS - bbt_time(), beat_at_frame(), frame_at_beat(), frame_time() + bbt_at_frame(), frame_at_bbt(), beat_at_frame(), frame_at_beat() and bbt_duration_at() are all sensitive to tempo and meter, and will give answers that align with the grid formed by tempo and meter sections. @@ -445,12 +445,12 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible framepos_t framepos_minus_beats (framepos_t, Evoral::Beats) const; Evoral::Beats framewalk_to_beats (framepos_t pos, framecnt_t distance) const; - std::pair predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt); void gui_move_tempo (TempoSection*, const framepos_t& frame); void gui_move_meter (MeterSection*, const framepos_t& frame); bool gui_change_tempo (TempoSection*, const Tempo& bpm); void gui_dilate_tempo (TempoSection* tempo, const framepos_t& frame, const framepos_t& end_frame, const double& pulse); + std::pair predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt); bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt); PBD::Signal0 MetricPositionChanged; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 2b5aac45f7..646a15b6f3 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1926,6 +1926,7 @@ TempoMap::check_solved (const Metrics& metrics) const continue; } if (prev_t) { + /* check ordering */ if ((t->frame() <= prev_t->frame()) || (t->pulse() <= prev_t->pulse())) { return false; } @@ -1936,6 +1937,14 @@ TempoMap::check_solved (const Metrics& metrics) const return false; } } + + /* gradient limit - who knows what it should be? + things are also ok (if a little chaotic) without this + */ + if (fabs (prev_t->c_func()) > 200.0) { + //std::cout << "c : " << prev_t->c_func() << std::endl; + return false; + } } prev_t = t; }