Get rid of the dedicated AEffect socket

This commit is contained in:
Robbert van der Helm
2020-05-13 13:15:52 +02:00
parent 85be5de0ed
commit 37a74c8f98
6 changed files with 35 additions and 33 deletions
+8 -5
View File
@@ -68,7 +68,6 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
vst_host_callback(io_context),
host_vst_parameters(io_context),
host_vst_process_replacing(io_context),
vst_host_aeffect(io_context),
host_callback_function(host_callback),
logger(Logger::create_from_environment(
create_logger_prefix(socket_endpoint.path()))),
@@ -164,7 +163,6 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
socket_acceptor.accept(vst_host_callback);
socket_acceptor.accept(host_vst_parameters);
socket_acceptor.accept(host_vst_process_replacing);
socket_acceptor.accept(vst_host_aeffect);
finished_accepting_sockets = true;
// There's no need to keep the socket endpoint file around after accepting
@@ -220,9 +218,14 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
});
// 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
// this during initialization.
const auto initialized_plugin = read_object<AEffect>(vst_host_aeffect);
// done after we started accepting host callbacks as the plugin will likely
// call these during its initialization. We reuse the `dispatcher()` socket
// for this since this has to be done only once.
const auto initialization_data =
read_object<EventResult>(host_vst_dispatch);
const auto initialized_plugin =
std::get<AEffect>(initialization_data.payload);
update_aeffect(plugin, initialized_plugin);
}
+6 -7
View File
@@ -129,6 +129,12 @@ class PluginBridge {
// instance the socket named `host_vst_dispatch` forwards
// `AEffect.dispatch()` calls from the native VST host to the Windows VST
// plugin (through the Wine VST host).
/**
* The socket that forwards all `dispatcher()` calls from the VST host to
* the plugin. This is also used once at startup to populate the values of
* the `AEffect` object.
*/
boost::asio::local::stream_protocol::socket host_vst_dispatch;
/**
* Used specifically for the `effProcessEvents` opcode. This is needed
@@ -145,13 +151,6 @@ class PluginBridge {
boost::asio::local::stream_protocol::socket host_vst_parameters;
boost::asio::local::stream_protocol::socket host_vst_process_replacing;
/**
* This socket only handles updates of the `AEffect` struct instead of
* passing through function calls. It's also used during initialization to
* pass the Wine plugin's information to the host.
*/
boost::asio::local::stream_protocol::socket vst_host_aeffect;
/**
* Whether we're done accepting sockets. The plugin may hang indefinitely if
* the Wine process fails to start, since then nothing will connect to our
+6 -6
View File
@@ -73,8 +73,7 @@ WineBridge::WineBridge(std::string plugin_dll_path,
host_vst_dispatch_midi_events(io_context),
vst_host_callback(io_context),
host_vst_parameters(io_context),
host_vst_process_replacing(io_context),
vst_host_aeffect(io_context) {
host_vst_process_replacing(io_context) {
// Got to love these C APIs
if (plugin_handle == nullptr) {
throw std::runtime_error("Could not load the Windows .dll file at '" +
@@ -106,7 +105,6 @@ WineBridge::WineBridge(std::string plugin_dll_path,
vst_host_callback.connect(socket_endpoint);
host_vst_parameters.connect(socket_endpoint);
host_vst_process_replacing.connect(socket_endpoint);
vst_host_aeffect.connect(socket_endpoint);
// Initialize after communication has been set up
// We'll try to do the same `get_bridge_isntance` trick as in
@@ -123,9 +121,11 @@ WineBridge::WineBridge(std::string plugin_dll_path,
current_bridge_instance = nullptr;
plugin->ptr1 = this;
// Send the plugin's information to the Linux VST plugin. Any updates during
// runtime are handled using the `audioMasterIOChanged` host callback.
write_object(vst_host_aeffect, *plugin);
// Send the plugin's information to the Linux VST plugin. This is done over
// the `dispatch()` socket since this has to be done only once during
// initialization. Any updates during runtime are handled using the
// `audioMasterIOChanged` host callback.
write_object(host_vst_dispatch, EventResult{0, *plugin, std::nullopt});
// This works functionally identically to the `handle_dispatch()` function
// below, but this socket will only handle MIDI events. This is needed
+6 -7
View File
@@ -124,6 +124,12 @@ class WineBridge {
// instance the socket named `host_vst_dispatch` forwards
// `AEffect.dispatch()` calls from the native VST host to the Windows VST
// plugin (through the Wine VST host).
/**
* The socket that forwards all `dispatcher()` calls from the VST host to
* the plugin. This is also used once at startup to populate the values of
* the `AEffect` object.
*/
boost::asio::local::stream_protocol::socket host_vst_dispatch;
/**
* Used specifically for the `effProcessEvents` opcode. This is needed
@@ -140,13 +146,6 @@ class WineBridge {
boost::asio::local::stream_protocol::socket host_vst_parameters;
boost::asio::local::stream_protocol::socket host_vst_process_replacing;
/**
* This socket only handles updates of the `AEffect` struct instead of
* passing through function calls. It's also used during initialization to
* pass the Wine plugin's information to the host.
*/
boost::asio::local::stream_protocol::socket vst_host_aeffect;
/**
* The thread that specifically handles `effProcessEvents` opcodes so the
* plugin can still receive MIDI during GUI interaction to work around Win32