mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Use a thread for dispatch events
This commit is contained in:
@@ -95,10 +95,15 @@ HostBridge::HostBridge(audioMasterCallback host_callback)
|
||||
plugin.getParameter = getParameter_proxy;
|
||||
plugin.processReplacing = process_replacing_proxy;
|
||||
|
||||
// TODO: Replace manual thread creation with an async_read loop
|
||||
// Start accepting host callbacks after we've set up our sockets and basic
|
||||
// `AEffect` struct.
|
||||
removeme = std::thread([&]() { return host_callback_loop(); });
|
||||
// For our communication we use simple threads and blocking operations
|
||||
// instead of asynchronous IO since communication has to be handled in
|
||||
// lockstep anyway
|
||||
host_callback_handler = std::thread([&]() {
|
||||
while (true) {
|
||||
passthrough_event(vst_host_callback, &plugin,
|
||||
host_callback_function);
|
||||
}
|
||||
});
|
||||
|
||||
// Read the plugin's information from the Wine process. This can only be
|
||||
// done after we started accepting host callbacks as the plugin might do
|
||||
@@ -261,15 +266,6 @@ fs::path generate_endpoint_name() {
|
||||
return candidate_endpoint;
|
||||
}
|
||||
|
||||
// TODO: Replace blocking loop with async readers or threads for all of the
|
||||
// sockets. Also extract this functionality somewhere since the host event
|
||||
// callback needs to do exactly the same thing.
|
||||
void HostBridge::host_callback_loop() {
|
||||
while (true) {
|
||||
passthrough_event(vst_host_callback, &plugin, host_callback_function);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate the wineprefix and set the `WINEPREFIX` environment variable if found.
|
||||
* This way it's also possible to run .dll files outside of a wineprefix using
|
||||
|
||||
Reference in New Issue
Block a user