diff options
author | nick_m <mainsbridge@gmail.com> | 2016-04-18 07:00:19 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:15 +1000 |
commit | 29e0b2e5bfa0b1d107ee5644bddea06aa9cdaf8a (patch) | |
tree | 0f2d09c48e30ccc1ae2880932c9105f054c19187 /gtk2_ardour | |
parent | 5e2280eeada72923e9d3399a01742bd6ff2dca12 (diff) |
Tempo ramps - make moving music-locked meters less flakey, remove some code.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index f62ba1d2eb..63fff4e463 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3174,10 +3174,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) } else { _editor->begin_reversible_command (_("copy meter mark")); - Timecode::BBT_Time bbt; - map.bbt_time (adjusted_current_frame (event, false), bbt); - /* round bbt to bars */ - map.round_bbt (bbt, -1); + Timecode::BBT_Time bbt = _real_section->bbt(); /* we can't add a meter where one currently exists */ if (_real_section->frame() < adjusted_current_frame (event, false)) { @@ -3200,11 +3197,18 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) if (_marker->meter().position_lock_style() == MusicTime) { TempoMap& map (_editor->session()->tempo_map()); Timecode::BBT_Time bbt; - map.bbt_time (adjusted_current_frame (event, false), bbt); + map.bbt_time (pf, bbt); /* round bbt to bars */ map.round_bbt (bbt, -1); - const double beat = map.bbt_to_beats (bbt); - _editor->session()->tempo_map().gui_move_meter (_real_section, beat); + + if (bbt.bars > _real_section->bbt().bars) { + const double pulse = _real_section->pulse() + (_real_section->note_divisor() / _real_section->divisions_per_bar()); + _editor->session()->tempo_map().gui_move_meter (_real_section, pulse); + } else if (bbt.bars < _real_section->bbt().bars) { + const MeterSection& prev_m = map.meter_section_at (pf); + const double pulse = _real_section->pulse() - (prev_m.note_divisor() / prev_m.divisions_per_bar()); + _editor->session()->tempo_map().gui_move_meter (_real_section, pulse); + } } else { _editor->session()->tempo_map().gui_move_meter (_real_section, pf); } |