summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-08-19 13:40:37 +0000
committerCarl Hetherington <carl@carlh.net>2011-08-19 13:40:37 +0000
commitefc6b2869fc5840cd1ffd85eb51b1ffbf737c897 (patch)
tree322dbb8ba4a01bf2362a2162502995622f38de39
parent5d2b5d3c5965d3a95998d8a957b4cea6dec3ae37 (diff)
Fix up note snapping so that we snap to the note we're over.
git-svn-id: svn://localhost/ardour2/branches/3.0@10008 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/midi_region_view.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index dd9f686561..cf60580327 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -3327,7 +3327,7 @@ MidiRegionView::update_ghost_note (double x, double y)
PublicEditor& editor = trackview.editor ();
- framepos_t const unsnapped_frame = editor.pixel_to_frame (x);
+ framepos_t unsnapped_frame = editor.pixel_to_frame (x);
bool success;
Evoral::MusicalTime grid_beats = editor.get_grid_type_as_beats (success, unsnapped_frame);
@@ -3336,7 +3336,16 @@ MidiRegionView::update_ghost_note (double x, double y)
}
framecnt_t const grid_frames = region_beats_to_region_frames (grid_beats);
+
+ /* Hack so that we always snap to the note that we are over, instead of snapping
+ to the next one if we're more than halfway through the one we're over.
+ */
+ if (unsnapped_frame >= grid_frames / 2) {
+ unsnapped_frame -= grid_frames / 2;
+ }
+
framepos_t f = snap_frame_to_frame (unsnapped_frame);
+
/* use region_frames... because we are converting a delta within the region
*/