From b86df213fbfede664b38edec9e187ec8714429bb Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 11 Jan 2021 19:03:41 +0100 Subject: [PATCH] Change to SCHED_OTHER on IPlugView init/destruct Instead of only on `IPlugView::attached`/`IPlugView::removed` like in the previous commit. I forgot to also do this when creating and destroying IPlugViews (since I can assume lots of plugins will then already start loading resources). --- src/wine-host/bridges/vst3.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 6a5bf3e1..00a4c189 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -95,10 +95,12 @@ void Vst3Bridge::run() { // drop it here as well, along with the `IPlugFrame` // proxy object it may have received in // `IPlugView::setFrame()`. + set_realtime_priority(false); object_instances[request.owner_instance_id] .plug_view_instance.reset(); object_instances[request.owner_instance_id] .plug_frame_proxy.reset(); + set_realtime_priority(true); }) .wait(); @@ -370,11 +372,17 @@ void Vst3Bridge::run() { // Instantiate the object from the GUI thread main_context .run_in_context([&]() { + // NOTE: Just like in the event loop, we want to run + // this with lower priority to prevent whatever + // operation the plugin does while it's loading + // its editor from preempting the audio thread. + set_realtime_priority(false); object_instances[request.instance_id] .plug_view_instance.emplace(Steinberg::owned( object_instances[request.instance_id] .edit_controller->createView( request.name.c_str()))); + set_realtime_priority(true); }) .wait(); @@ -552,10 +560,6 @@ void Vst3Bridge::run() { // be done in the main UI thread return main_context .run_in_context([&]() { - // NOTE: Just like in the event loop, we want to run - // this with lower priority to prevent whatever - // operation the plugin does while it's loading - // its editor from preempting the audio thread. set_realtime_priority(false); Editor& editor_instance = object_instances[request.owner_instance_id]