From 09c9ab5c75c9b86bba331305089cf26662ce32b4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 27 Oct 2022 13:40:29 -0600 Subject: [PATCH] extend TempoMapChange API to allow for replacing, not editing, the map --- gtk2_ardour/tempo_map_change.cc | 9 +++++++++ gtk2_ardour/tempo_map_change.h | 1 + 2 files changed, 10 insertions(+) diff --git a/gtk2_ardour/tempo_map_change.cc b/gtk2_ardour/tempo_map_change.cc index 6607d39229..0cc553e10a 100644 --- a/gtk2_ardour/tempo_map_change.cc +++ b/gtk2_ardour/tempo_map_change.cc @@ -63,3 +63,12 @@ TempoMapChange::abort () begun = false; } } + +void +TempoMapChange::use_new_map (Temporal::TempoMap::WritableSharedPtr new_map) +{ + /* existing write copy goes out of scope, and is deleted, We continue + * on with the new map, and will RCU-update it in our destructor. + */ + writable_map = new_map; +} diff --git a/gtk2_ardour/tempo_map_change.h b/gtk2_ardour/tempo_map_change.h index 072bacb8e1..de3fea0aa4 100644 --- a/gtk2_ardour/tempo_map_change.h +++ b/gtk2_ardour/tempo_map_change.h @@ -41,6 +41,7 @@ class TempoMapChange { void begin (); void abort (); + void use_new_map (Temporal::TempoMap::WritableSharedPtr); Temporal::TempoMap& map() const { return *writable_map.get(); }