From 991ab1f8f88a4f427caf52c5b0f0cc7d18d3ad44 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 23 Oct 2022 23:24:12 +0200 Subject: [PATCH] Handle tempo-map changes in sync from the calling thread This is required to collect relevent undo/redo information, notably automation-data changes from Playlist::update_after_tempo_map_change and DiskReader::playlist_ranges_moved. The realtime thread should not move regions to begin with, and debug builds woudl also assert since no undo operation was started. --- libs/ardour/audioengine.cc | 3 --- libs/ardour/session.cc | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 2bfe036a42..b158a3c1bf 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -292,9 +292,6 @@ AudioEngine::process_callback (pframes_t nframes) Temporal::TempoMap::WritableSharedPtr 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 diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ab32599b8f..0485dfdde8 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -502,6 +502,8 @@ Session::Session (AudioEngine &eng, IOPluginsChanged.connect_same_thread (*this, boost::bind (&Session::resort_io_plugs, this)); + TempoMap::MapChanged.connect_same_thread (*this, boost::bind (&Session::tempo_map_changed, this)); + emit_thread_start (); auto_connect_thread_start ();