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()
This commit is contained in:
Robin Gareus 2022-06-17 17:07:47 +02:00
parent 7724af1850
commit 86ddb11b9b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 1 additions and 2 deletions

View File

@ -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;