From 7850628f6f8d9ca1fd3ef4f9bdaa4cdd66b0e3f1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 5 Dec 2022 14:54:40 -0700 Subject: [PATCH] fix manual drawing of MIDI automation (avoid offset) #9142 Change assumption that the "pos" argument to AutomationRegionView::add_automation_event is region-relative, by making it global. This did not affect non-MIDI automation because that used AutomationTimeAxisView::add_automation_view() instead. --- gtk2_ardour/automation_region_view.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index d3081cae92..afe5948ac3 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -160,16 +160,14 @@ AutomationRegionView::canvas_group_event (GdkEvent* ev) * adding the point. */ - const timepos_t pos = timepos_t (e.pixel_to_sample (x) - _region->position_sample() + _region->start_sample()); - - add_automation_event (ev, pos, y, with_guard_points); + add_automation_event (ev, timepos_t (e.pixel_to_sample (x)), y, with_guard_points); return true; } return RegionView::canvas_group_event (ev); } -/** @param when Position in samples, where 0 is the start of the region. +/** @param when Position is global time position * @param y y position, relative to our TimeAxisView. */ void @@ -192,7 +190,7 @@ AutomationRegionView::add_automation_event (GdkEvent *, timepos_t const & w, dou /* snap time */ - when = snap_region_time_to_region_time (_region->start().distance (when), false) + _region->start (); + when = snap_region_time_to_region_time (_region->source_position().distance (when), false); /* map using line */