From f559bed13e1da164cef3722fd6be5512394d53c9 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 8 Oct 2022 17:57:26 +0200 Subject: [PATCH] Remove audio thread mutual recursion for CLAP We can always add this back in later if we do need it. --- src/wine-host/bridges/clap.h | 55 ++---------------------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/src/wine-host/bridges/clap.h b/src/wine-host/bridges/clap.h index 53dc6fed..a5bf9100 100644 --- a/src/wine-host/bridges/clap.h +++ b/src/wine-host/bridges/clap.h @@ -262,12 +262,9 @@ class ClapBridge : public HostBridge { /** * When called from the GUI thread, spawn a new thread and call * `send_message()` from there, and then handle functions passed by calls to - * `do_mutual_recursion_on_gui_thread()` and - * `do_mutual_recursion_on_off_thread()` on this thread until we get a - * response back. See the function in `Vst3Bridge` for a much more in-depth - * explanatio nof why this is neede.d - * - * TODO: Is this needed for CLAP? + * `do_mutual_recursion_on_gui_thread()` this thread until we get a response + * back. See the function in `Vst3Bridge` for a much more in-depth + * explanatio nof why this is needed. */ template typename T::Response send_mutually_recursive_message(const T& object) { @@ -275,15 +272,11 @@ class ClapBridge : public HostBridge { return mutual_recursion_.fork( [&]() { return send_main_thread_message(object); }); } else { - // TODO: Remove if this isn't needed logger_.log_trace([]() { return "'ClapBridge::send_mutually_recursive_message()' called " "from a non-GUI thread, sending the message directly"; }); send_main_thread_message(object); - - // return audio_thread_mutual_recursion_.fork( - // [&]() { return send_message(object); }); } } @@ -310,24 +303,6 @@ class ClapBridge : public HostBridge { } } - // TODO: Check if this is needed, remove if it isn't - - // /** - // * The same as the above function, but we'll just execute the function on - // * this thread when the mutual recursion context is not active. - // * - // * @see ClapBridge::do_mutual_recursion_on_gui_thread - // */ - // template - // std::invoke_result_t do_mutual_recursion_on_off_thread(F&& fn) { - // if (const auto result = audio_thread_mutual_recursion_.maybe_handle( - // std::forward(fn))) { - // return *result; - // } else { - // return mutual_recursion_.handle(std::forward(fn)); - // } - // } - /** * Fetch the plugin instance along with a lock valid for the instance's * lifetime. This is mostly just to save some boilerplate everywhere. Use @@ -463,28 +438,4 @@ class ClapBridge : public HostBridge { * response. */ MutualRecursionHelper mutual_recursion_; - - // TODO: Check if this is needed, remove it if it isn't - // /** - // * The same thing as above, but just for the pair of - // * `IEditController::setParamNormalized()` and - // * `IComponentHandler::performEdit()`, when - // * `IComponentHandler::performEdit()` is called from an audio thread. - // * - // * HACK: This is sadly needed to work around an interaction between a bug - // in - // * JUCE with a bug in Ardour/Mixbus. JUCE calls - // * `IComponentHandler::performEdit()` from the audio thread instead - // of - // * using the output parameters, and Ardour/Mixbus immediately call - // * `IEditController::setParamNormalized()` with the same value - // after - // * the plugin calls `IComponentHandler::performEdit()`. Both of - // these - // * functions need to be run on the same thread (because of - // recursive - // * mutexes), but they may not interfere with the GUI thread if - // * `IComponentHandler::performEdit()` wasn't called from there. - // */ - // MutualRecursionHelper audio_thread_mutual_recursion_; };