diff options
author | nick_m <mainsbridge@gmail.com> | 2017-01-27 00:41:17 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2017-02-04 22:57:36 +1100 |
commit | 59daffea1d78cb55b35fe19c135cc4ab472bd01d (patch) | |
tree | 45e514f2e4f5a1935e360fd4fa3e2475ec217006 /gtk2_ardour/step_editor.cc | |
parent | a21a414615505269bf770ad2358482e698e841af (diff) |
rework snap
snap now fills in a struct (MusicFrame) which contins a snapped frame
along with a music divisor.
this gives useful information wrt magnetic snap which may or may not
have rounded to an exact musical position.
region position may now be set musically (using quarter notes for now).
this patch fixes several problems in the current code:
- dragging a list of music-locked regions now maintains correct
musical offsets within the list.
- splitting regions using magnetic snap works correctly (#7192)
- cut drag should now work correctly with magnetic snap.
- musical length of split midi regions is no longer frame based.
Diffstat (limited to 'gtk2_ardour/step_editor.cc')
-rw-r--r-- | gtk2_ardour/step_editor.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index c45c0f4461..ac51076a46 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -116,13 +116,12 @@ StepEditor::prepare_step_edit_region () } else { const Meter& m = _mtv.session()->tempo_map().meter_at_frame (step_edit_insert_position); - double baf = max (0.0, _mtv.session()->tempo_map().beat_at_frame (step_edit_insert_position)); double next_bar_in_beats = baf + m.divisions_per_bar(); framecnt_t next_bar_pos = _mtv.session()->tempo_map().frame_at_beat (next_bar_in_beats); framecnt_t len = next_bar_pos - step_edit_insert_position; - step_edit_region = _mtv.add_region (step_edit_insert_position, len, true, _editor.get_grid_music_divisions (0)); + step_edit_region = _mtv.add_region (step_edit_insert_position, len, true); RegionView* rv = _mtv.midi_view()->find_view (step_edit_region); step_edit_region_view = dynamic_cast<MidiRegionView*>(rv); @@ -411,7 +410,7 @@ StepEditor::step_edit_bar_sync () } framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos); - fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways); + fpos = _session->tempo_map().round_to_bar (fpos, RoundUpAlways).frame; step_edit_beat_pos = step_edit_region_view->region_frames_to_region_beats (fpos - step_edit_region->position()).round_up_to_beat(); step_edit_region_view->move_step_edit_cursor (step_edit_beat_pos); } |