From 558e32e6397d0a63791316206a313568fb381419 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 6 Aug 2024 20:30:20 +0200 Subject: [PATCH] VST3: handle offline FX processing callbacks This fixes potential deadlocks, when not using rt process threads. --- libs/ardour/vst3_plugin.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index f602fece01..a7629b185c 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -1676,7 +1676,7 @@ VST3PI::restartComponent (int32 flags) if (flags & Vst::kReloadComponent) { Glib::Threads::Mutex::Lock pl (_process_lock, Glib::Threads::NOT_LOCK); - if (!AudioEngine::instance ()->in_process_thread () && !_is_loading_state && !_restart_component_is_synced) { + if (!AudioEngine::instance ()->in_process_thread () && !_is_loading_state && !_restart_component_is_synced && !_process_offline) { pl.acquire (); } else { assert (0); // a plugin should not call this while processing @@ -1694,7 +1694,7 @@ VST3PI::restartComponent (int32 flags) } if (flags & Vst::kParamValuesChanged) { Glib::Threads::Mutex::Lock pl (_process_lock, Glib::Threads::NOT_LOCK); - if (!AudioEngine::instance ()->in_process_thread () && !_is_loading_state && !_restart_component_is_synced) { + if (!AudioEngine::instance ()->in_process_thread () && !_is_loading_state && !_restart_component_is_synced && !_process_offline) { pl.acquire (); } update_shadow_data (); @@ -1709,7 +1709,7 @@ VST3PI::restartComponent (int32 flags) * changes are automatically picked up. */ Glib::Threads::Mutex::Lock pl (_process_lock, Glib::Threads::NOT_LOCK); - if (!AudioEngine::instance ()->in_process_thread () && !_is_loading_state && !_restart_component_is_synced) { + if (!AudioEngine::instance ()->in_process_thread () && !_is_loading_state && !_restart_component_is_synced && !_process_offline) { /* Some plugins (e.g BlendEQ) call this from the process, * IPlugProcessor::ProcessBuffers. In that case taking the * _process_lock would deadlock.