From 22b50c1716bda71e8f97471e21ebcf6bde8bc57d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 14 Mar 2022 14:02:09 -0600 Subject: [PATCH] ensure that Session handles tempo map changes synchronously in the main RT process thread --- libs/ardour/ardour/session.h | 3 +-- libs/ardour/audioengine.cc | 8 +++++++- libs/ardour/session.cc | 2 -- libs/ardour/session_process.cc | 3 --- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 8ca1665127..e616090f88 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1384,6 +1384,7 @@ protected: void set_transport_speed (double speed); void set_default_play_speed (double spd); bool need_declick_before_locate () const; + void tempo_map_changed (); private: int create (const std::string& mix_template, BusProfile const *, bool unnamed); @@ -1892,8 +1893,6 @@ private: int send_full_time_code (samplepos_t, pframes_t nframes); void send_song_position_pointer (samplepos_t); - void tempo_map_changed (); - /* edit/mix groups */ int load_route_groups (const XMLNode&, int); diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index c36316ee0a..c96952a36c 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -289,7 +289,13 @@ AudioEngine::process_callback (pframes_t nframes) thread_init_callback (NULL); } - Temporal::TempoMap::fetch (); + Temporal::TempoMap::SharedPtr current_map = Temporal::TempoMap::read (); + if (current_map != Temporal::TempoMap::use()) { + Temporal::TempoMap::set (current_map); + if (_session) { + _session->tempo_map_changed (); + } + } /* This is for JACK, where the latency callback arrives in sync with * port registration (usually while ardour holds the process-lock diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2c3fb69a7d..58c34e28bb 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -476,8 +476,6 @@ Session::Session (AudioEngine &eng, Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Session::config_changed, this, _1, false)); config.ParameterChanged.connect_same_thread (*this, boost::bind (&Session::config_changed, this, _1, true)); - TempoMap::MapChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this)); - if (was_dirty) { DirtyChanged (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index f66ae0f6ab..422c01bc06 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -1628,10 +1628,7 @@ Session::implement_master_strategy () void Session::sync_cues () { - std::cerr << "Need to sync cues!\n"; - _locations->apply (*this, &Session::sync_cues_from_list); - } struct LocationByTime