Handle incoming events from off-threads separately

On the Wine side we want to handle most events on the main UI thread.
We'll assume any events coming in from a secondary socket are safe and
can be handled directly.
This commit is contained in:
Robbert van der Helm
2020-10-26 13:45:19 +01:00
parent 81efa6febe
commit 8d7826f1df
4 changed files with 57 additions and 33 deletions
+2 -3
View File
@@ -121,10 +121,9 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
// instead of asynchronous IO since communication has to be handled in
// lockstep anyway
host_callback_handler = std::jthread([&]() {
// TODO: Think of a nicer way to structure this and the similar
// handler in `Vst2Bridge::handle_dispatch_midi_events`
sockets.vst_host_callback.receive(
std::pair<Logger&, bool>(logger, false), [&](Event& event) {
std::pair<Logger&, bool>(logger, false),
[&](Event& event, bool /*on_main_thread*/) {
// MIDI events sent from the plugin back to the host are a
// special case here. They have to sent during the
// `processReplacing()` function or else the host will ignore