From b39db7ebeb7ab931a5528d273e65efca3d866441 Mon Sep 17 00:00:00 2001 From: nick_m Date: Tue, 29 Mar 2016 07:19:11 +1100 Subject: [PATCH] Tempo ramps - a saner way to snap music-locked tempos. --- gtk2_ardour/editor_drag.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 4ca5462d67..5cecd952a0 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3317,7 +3317,6 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) } framepos_t pf; - double beat = 0.0; Tempo const tp = _marker->tempo(); if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::constraint_modifier ())) { @@ -3351,12 +3350,15 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) _editor->session()->tempo_map().bbt_time (pf, when); if (_real_section->position_lock_style() == MusicTime) { + + const double pulse = _editor->session()->tempo_map().predict_tempo_pulse (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), pf); + when = _editor->session()->tempo_map().pulse_to_bbt (pulse); if (use_snap && _editor->snap_type() == SnapToBar) { _editor->session()->tempo_map().round_bbt (when, -1); } else if (use_snap) { _editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0)); } - beat = _editor->session()->tempo_map().bbt_to_beats (when); + const double beat = _editor->session()->tempo_map().bbt_to_beats (when); _editor->session()->tempo_map().gui_move_tempo_beat (_real_section, tp, beat); } else { if (use_snap && _editor->snap_type() == SnapToBar) {