From 86ddb11b9b73265e7a4499cf0ae83f75e1daf20d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 17 Jun 2022 17:07:47 +0200 Subject: [PATCH] Fix displaying note events across tempo-changes Note position in samples must be calculated using absolute position on the timeline. Otherwise the tempo-map is not applied correctly. Previously this caused issues since the position was first offset back by _region->position() - time relative to region left edge - and then the tempo-map was applied. Another solution identically would be: (note_start + session_source_start).samples() - _region->position().samples() --- gtk2_ardour/midi_region_view.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 8f57b6db06..f5d3220565 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1808,12 +1808,11 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions) * note, then subtract the start of the region */ - const samplepos_t note_start_samples = (note_start + session_source_start).earlier ( _region->position()).samples(); + const samplepos_t note_start_samples = _region->position().distance ((note_start + session_source_start)).samples(); const double x0 = trackview.editor().sample_to_pixel (note_start_samples); double x1; - const double y0 = 1 + floor(note_to_y(note->note())); double y1;