summaryrefslogtreecommitdiff
path: root/libs/ardour/tempo.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-06-22 01:18:00 +1000
committernick_m <mainsbridge@gmail.com>2017-07-22 02:15:20 +1000
commitc03da364ad31dc31e90f954e6d8f7e38a59bdcfd (patch)
tree7aa2f3b360dba2a5d45eacd0eddbe608030b8666 /libs/ardour/tempo.cc
parent515cdb6b32d2e7dbddeaf7b72105a1eb0aef9634 (diff)
Fix incorrect double-snap when moving audio-locked tempi
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r--libs/ardour/tempo.cc35
1 files changed, 17 insertions, 18 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 702490bc0d..020f4390ce 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -3243,25 +3243,24 @@ TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t& frame, con
Glib::Threads::RWLock::WriterLock lm (lock);
TempoSection* tempo_copy = copy_metrics_and_point (_metrics, future_map, ts);
- if (solve_map_minute (future_map, tempo_copy, minute_at_frame (frame))) {
- if (sub_num != 0) {
- /* We're moving the object that defines the grid while snapping to it...
- * 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).
- *
- * This alters the snap behaviour slightly in that we snap to beat divisions
- * in the future map rather than the existing one.
- */
- const double qn = exact_qn_at_frame_locked (future_map, frame, sub_num);
- const framepos_t snapped_frame = frame_at_minute (minute_at_pulse_locked (future_map, qn / 4.0));
- 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 {
+ if (sub_num != 0) {
+ /* We're moving the object that defines the grid while snapping to it...
+ * 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).
+ * We fudge around this by doing this in the musical domain and then swapping back for the recompute.
+ */
+ const double qn = exact_qn_at_frame_locked (_metrics, frame, sub_num);
+ tempo_copy->set_position_lock_style (MusicTime);
+ if (solve_map_pulse (future_map, tempo_copy, qn / 4.0)) {
+ ts->set_position_lock_style (MusicTime);
+ solve_map_pulse (_metrics, ts, qn / 4.0);
+ ts->set_position_lock_style (AudioTime);
+ recompute_meters (_metrics);
+ }
+ } else {
+ if (solve_map_minute (future_map, tempo_copy, minute_at_frame (frame))) {
solve_map_minute (_metrics, ts, minute_at_frame (frame));
recompute_meters (_metrics);
}