From fd5594f831022fe7ccf3bbfbc56f6a9258022c1b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 15 Nov 2021 21:26:23 -0700 Subject: [PATCH] use Editor::reassociate_metric_markers() before performing edits on tempo map The objects referenced by markers point to the copy of the map held by the per-thread ptr. But the edits must be done on a writable copy of the map. ::reassociate_metric_markers() fixes the references to use the writable copy, so that when we pass references to the objects in the map to the writable copy, it will find them and modify them (rather then ones in the previous generation of the tempo map) --- gtk2_ardour/editor_markers.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 78958ca48d..7702261f9d 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1501,12 +1501,12 @@ Editor::toggle_tempo_type () dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm); if (tm) { - Temporal::TempoPoint & tempo = tm->tempo(); begin_reversible_command (_("set tempo to constant")); TempoMap::SharedPtr tmap (TempoMap::write_copy()); reassociate_metric_markers (tmap); + Temporal::TempoPoint & tempo = tm->tempo(); XMLNode &before = tmap->get_state(); @@ -1533,9 +1533,8 @@ Editor::toggle_tempo_clamped () TempoMap::SharedPtr tmap (TempoMap::write_copy()); XMLNode &before = tmap->get_state(); - Temporal::Tempo & tempo (tm->tempo()); - reassociate_metric_markers (tmap); + Temporal::Tempo & tempo (tm->tempo()); tempo.set_clamped (!tempo.clamped()); @@ -1562,9 +1561,10 @@ Editor::ramp_to_next_tempo () XMLNode &before = tmap->get_state(); reassociate_metric_markers (tmap); - Temporal::TempoPoint & tempo (tm->tempo()); + tmap->set_ramped (tempo, !tempo.ramped()); + XMLNode &after = tmap->get_state(); _session->add_command (new MementoCommand (new Temporal::TempoMap::MementoBinder(), &before, &after)); commit_reversible_command ();