diff options
author | nick_m <mainsbridge@gmail.com> | 2016-03-29 04:13:37 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:12 +1000 |
commit | 354567e5a72c3d24fb13d8b47a51b1c3859918ea (patch) | |
tree | 2edb4c0b43a31d3d9a301e3627457aa22745f2a3 /gtk2_ardour | |
parent | a2797f4d386f43377dd869f2b986d4cd410c183e (diff) |
Tempo ramps - switch MusicLocked tempos to beat-based dragging. fix various bugs wrt future-snapped tempo drags
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 36 |
2 files changed, 24 insertions, 14 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 155024f720..6e59cfc912 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2157,6 +2157,8 @@ Editor::snap_musical() const case SnapToBeatDiv4: case SnapToBeatDiv3: case SnapToBeatDiv2: + case SnapToBeat: + case SnapToBar: return true; default: break; diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 3305bfd040..b6083281ab 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3317,18 +3317,29 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) } framepos_t pf; + double beat = 0.0; + if (!_editor->snap_musical()) { pf = adjusted_current_frame (event); } else { - pf = adjusted_current_frame (event); + pf = adjusted_current_frame (event, false); Timecode::BBT_Time when; _editor->session()->tempo_map().bbt_time (pf, when); - if (_editor->snap_type() == SnapToBar) { - _editor->session()->tempo_map().round_bbt (when, -1); + if (_real_section->position_lock_style() == MusicTime) { + if (_editor->snap_type() == SnapToBar) { + _editor->session()->tempo_map().round_bbt (when, -1); + } else { + _editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0)); + } + beat = _editor->session()->tempo_map().bbt_to_beats (when); } else { - _editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0)); + if (_editor->snap_type() == SnapToBar) { + _editor->session()->tempo_map().round_bbt (when, -1); + } else { + _editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0)); + } + pf = _editor->session()->tempo_map().predict_tempo_frame (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), when); } - pf = _editor->session()->tempo_map().predict_tempo_frame (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), when); } Tempo const tp = _marker->tempo(); @@ -3340,17 +3351,14 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) show_verbose_cursor_text (strs.str()); } else if (_movable) { - _marker->set_position (pf); - /* just here for a check/laugh - if (_real_section->position_lock_style() == MusicTime) { - const double baf = _editor->session()->tempo_map().beat_at_frame (pf); - _editor->session()->tempo_map().gui_move_tempo_beat (_real_section, tp, baf); - } else { - */ - _editor->session()->tempo_map().gui_move_tempo_frame (_real_section, tp, pf); - //} + if (_real_section->position_lock_style() == MusicTime) { + _editor->session()->tempo_map().gui_move_tempo_beat (_real_section, tp, beat); + } else { + _editor->session()->tempo_map().gui_move_tempo_frame (_real_section, tp, pf); + } show_verbose_cursor_time (pf); } + _marker->set_position (pf); } void |