mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-15 21:15:51 +02:00
Conditionally disiable the message loop from
Based on a function. This is needed because the message loop should be skipped while any of the plugins is opening their GUI, similar to how `EditorOpening` worked for individually hosted plugins.
This commit is contained in:
@@ -19,9 +19,6 @@
|
||||
#include <future>
|
||||
#include <iostream>
|
||||
|
||||
#include "../../common/communication.h"
|
||||
#include "../../common/events.h"
|
||||
|
||||
/**
|
||||
* A function pointer to what should be the entry point of a VST plugin.
|
||||
*/
|
||||
@@ -163,40 +160,6 @@ void Vst2Bridge::handle_dispatch() {
|
||||
}
|
||||
}
|
||||
|
||||
void Vst2Bridge::handle_dispatch(boost::asio::io_context& main_context) {
|
||||
using namespace std::placeholders;
|
||||
|
||||
// This works exactly the same as the function above, but execute the actual
|
||||
// event and run the message loop from the main thread that's also
|
||||
// instantiating these plugins. This is required for a few plugins to run
|
||||
// multiple instances in the same process
|
||||
try {
|
||||
while (true) {
|
||||
receive_event(
|
||||
host_vst_dispatch, std::nullopt,
|
||||
passthrough_event(
|
||||
plugin,
|
||||
[&](AEffect* plugin, int opcode, int index, intptr_t value,
|
||||
void* data, float option) -> intptr_t {
|
||||
std::promise<intptr_t> dispatch_result;
|
||||
boost::asio::dispatch(main_context, [&]() {
|
||||
const intptr_t result = dispatch_wrapper(
|
||||
plugin, opcode, index, value, data, option);
|
||||
|
||||
dispatch_result.set_value(result);
|
||||
});
|
||||
|
||||
return dispatch_result.get_future().get();
|
||||
}));
|
||||
|
||||
boost::asio::post(main_context, [&]() { pump_message_loop(); });
|
||||
}
|
||||
} catch (const boost::system::system_error&) {
|
||||
// The plugin has cut off communications, so we can shut down this host
|
||||
// application
|
||||
}
|
||||
}
|
||||
|
||||
void Vst2Bridge::handle_dispatch_midi_events() {
|
||||
try {
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user