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).
This commit is contained in:
Robbert van der Helm
2021-01-11 19:03:41 +01:00
parent 8f15578d8c
commit b86df213fb
+8 -4
View File
@@ -95,10 +95,12 @@ void Vst3Bridge::run() {
// drop it here as well, along with the `IPlugFrame` // drop it here as well, along with the `IPlugFrame`
// proxy object it may have received in // proxy object it may have received in
// `IPlugView::setFrame()`. // `IPlugView::setFrame()`.
set_realtime_priority(false);
object_instances[request.owner_instance_id] object_instances[request.owner_instance_id]
.plug_view_instance.reset(); .plug_view_instance.reset();
object_instances[request.owner_instance_id] object_instances[request.owner_instance_id]
.plug_frame_proxy.reset(); .plug_frame_proxy.reset();
set_realtime_priority(true);
}) })
.wait(); .wait();
@@ -370,11 +372,17 @@ void Vst3Bridge::run() {
// Instantiate the object from the GUI thread // Instantiate the object from the GUI thread
main_context main_context
.run_in_context<void>([&]() { .run_in_context<void>([&]() {
// 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] object_instances[request.instance_id]
.plug_view_instance.emplace(Steinberg::owned( .plug_view_instance.emplace(Steinberg::owned(
object_instances[request.instance_id] object_instances[request.instance_id]
.edit_controller->createView( .edit_controller->createView(
request.name.c_str()))); request.name.c_str())));
set_realtime_priority(true);
}) })
.wait(); .wait();
@@ -552,10 +560,6 @@ void Vst3Bridge::run() {
// be done in the main UI thread // be done in the main UI thread
return main_context return main_context
.run_in_context<tresult>([&]() { .run_in_context<tresult>([&]() {
// 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); set_realtime_priority(false);
Editor& editor_instance = Editor& editor_instance =
object_instances[request.owner_instance_id] object_instances[request.owner_instance_id]