Tempo ramps - fix constant tempo assumption wrt midi ghost note.
[ardour.git] / gtk2_ardour / midi_region_view.cc
index 61e9dea9d7a23fe72529f6852147a0c89dc4ce9b..e3ff928e1d0a527f19eb77497208c697eed20656 100644 (file)
@@ -4088,10 +4088,10 @@ framepos_t
 MidiRegionView::snap_frame_to_grid_underneath (framepos_t p, framecnt_t& grid_frames) const
 {
        PublicEditor& editor = trackview.editor ();
-
+       const Evoral::Beats p_beat = region_frames_to_region_beats (p);
        const Evoral::Beats grid_beats = get_grid_beats(p);
 
-       grid_frames = region_beats_to_region_frames (grid_beats);
+       grid_frames = region_beats_to_region_frames (p_beat + grid_beats) - region_beats_to_region_frames (p_beat);
 
        /* 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.