From 70652e3d234aa05facc9bb8ab56cfb16cb0600c6 Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 6 Feb 2025 09:39:51 +0000 Subject: [PATCH] AudioProcessor: Use new MessageManager::callSync --- .../format_types/juce_VST3PluginFormat.cpp | 2 +- .../format_types/juce_VSTPluginFormat.cpp | 2 +- .../juce_audio_processors.cpp | 20 ------------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 0abb77a962..82a9e601be 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -2621,7 +2621,7 @@ public: ~VST3PluginInstance() override { - callOnMessageThread ([this] { cleanup(); }); + MessageManager::callSync ([this] { cleanup(); }); } void cleanup() diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 68ca74d5ae..3c400a329b 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -1117,7 +1117,7 @@ struct VSTPluginInstance final : public AudioPluginInstance, ~VSTPluginInstance() override { if (vstEffect != nullptr && vstEffect->magic == 0x56737450 /* 'VstP' */) - callOnMessageThread ([this] { cleanup(); }); + MessageManager::callSync ([this] { cleanup(); }); } void cleanup() diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp index fc4eab2268..20fdc86cfb 100644 --- a/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/modules/juce_audio_processors/juce_audio_processors.cpp @@ -86,26 +86,6 @@ static bool arrayContainsPlugin (const OwnedArray& list, #endif -template -void callOnMessageThread (Callback&& callback) -{ - if (MessageManager::getInstance()->existsAndIsLockedByCurrentThread()) - { - callback(); - return; - } - - WaitableEvent completionEvent; - - MessageManager::callAsync ([&callback, &completionEvent] - { - callback(); - completionEvent.signal(); - }); - - completionEvent.wait(); -} - #if JUCE_MAC //==============================================================================