From 457b94ba650ab146aa2162330f67e8f77de74c64 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 15 Aug 2023 00:04:19 -0600 Subject: [PATCH] fix computation of note length after tempo mapping --- libs/ardour/midi_model.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 96f0321020..08cb077323 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -1835,16 +1835,16 @@ MidiModel::rebuild_from_mapping_stash (Temporal::Beats const & src_pos_offset) TempoMappingStash::iterator tms (tempo_mapping_stash.find (&on)); assert (tms != tempo_mapping_stash.end()); - Beats beat_time (tmap->quarters_at_superclock (tms->second) - src_pos_offset); + Beats start_time (tmap->quarters_at_superclock (tms->second) - src_pos_offset); - note_cmd->change (n, NoteDiffCommand::StartTime, beat_time); + note_cmd->change (n, NoteDiffCommand::StartTime, start_time); tms = tempo_mapping_stash.find (&off); assert (tms != tempo_mapping_stash.end()); - beat_time = tmap->quarters_at_superclock (tms->second) - src_pos_offset; - off.set_time (beat_time); + Beats end_time = tmap->quarters_at_superclock (tms->second) - src_pos_offset; - note_cmd->change (n, NoteDiffCommand::Length, beat_time); + Beats len = end_time - start_time; + note_cmd->change (n, NoteDiffCommand::Length, len); } apply_diff_command_as_subcommand (_midi_source.session(), note_cmd);