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/region_view.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/region_view.cc')
-rw-r--r-- | gtk2_ardour/region_view.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index cc9a5b61ce..9f6ff645ce 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -947,20 +947,19 @@ frameoffset_t RegionView::snap_frame_to_frame (frameoffset_t x, bool ensure_snap) const { PublicEditor& editor = trackview.editor(); - /* x is region relative, convert it to global absolute frames */ framepos_t const session_frame = x + _region->position(); /* try a snap in either direction */ - framepos_t frame = session_frame; + MusicFrame frame (session_frame, 0); editor.snap_to (frame, RoundNearest, false, ensure_snap); /* if we went off the beginning of the region, snap forwards */ - if (frame < _region->position ()) { - frame = session_frame; + if (frame.frame < _region->position ()) { + frame.frame = session_frame; editor.snap_to (frame, RoundUpAlways, false, ensure_snap); } /* back to region relative */ - return frame - _region->position(); + return frame.frame - _region->position(); } |