diff options
author | nick_m <mainsbridge@gmail.com> | 2016-12-12 02:01:12 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-12-12 02:07:00 +1100 |
commit | 9598f2a8115c5e259094f07493825c23fcb40833 (patch) | |
tree | 34385ed2420109e840f3ebccc4ec5bea2df38653 /libs/ardour/tempo.cc | |
parent | 0d7b298fbe5dd8cde48c1eb705223984772dd0f1 (diff) |
fix loop/crash when dragging an audio-locked tempo over a music-locked one while snapped to grid.
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r-- | libs/ardour/tempo.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index b2e2dbe1be..f901607338 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -3145,20 +3145,16 @@ TempoMap::gui_move_tempo (TempoSection* ts, const framepos_t& frame, const int& * Placing the ts at the beat corresponding to the requested frame may shift the * grid in such a way that the mouse is left hovering over a completerly different division, * causing jittering when the mouse next moves (esp. large tempo deltas). - * To avoid this, place the ts at the requested frame in a dummy map - * then find the closest beat subdivision to that frame in the dummy. + * * This alters the snap behaviour slightly in that we snap to beat divisions * in the future map rather than the existing one. */ - const double beat = exact_beat_at_frame_locked (future_map, frame, sub_num); - const double pulse = pulse_at_beat_locked (future_map, beat); - - if (solve_map_pulse (future_map, tempo_copy, pulse)) { - /* snapping to a grid. force MusicTime temporarily. */ - ts->set_position_lock_style (MusicTime); - solve_map_pulse (_metrics, ts, pulse); - ts->set_position_lock_style (AudioTime); + const double qn = exact_qn_at_frame_locked (future_map, frame, sub_num); + const framepos_t snapped_frame = frame_at_minute (minute_at_quarter_note_locked (future_map, qn)); + if (solve_map_minute (future_map, tempo_copy, minute_at_frame (snapped_frame))) { + solve_map_minute (_metrics, ts, minute_at_frame (snapped_frame)); + ts->set_pulse (qn / 4.0); recompute_meters (_metrics); } } else { |