mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
Request/send config for VST3 plugins
Using the new Vst3MessageHandler.
This commit is contained in:
@@ -195,7 +195,11 @@ class Sockets {
|
||||
/**
|
||||
* Depending on the value of the `listen` argument passed to the
|
||||
* constructor, either accept connections made to the sockets on the Linux
|
||||
* side or connect to the sockets on the Wine side
|
||||
* side or connect to the sockets on the Wine side.
|
||||
*
|
||||
* @remark On the plugin side `PluginBridge::connect_sockets_guarded()`
|
||||
* should be used instead so we can terminate everything in the event that
|
||||
* Wine fails to start.
|
||||
*/
|
||||
virtual void connect() = 0;
|
||||
|
||||
|
||||
@@ -38,8 +38,20 @@ Vst3PluginBridge::Vst3PluginBridge()
|
||||
// host
|
||||
connect_sockets_guarded();
|
||||
|
||||
// Now that communication is set up the Wine host can send callbacks to this
|
||||
// bridge class, and we can send control messages to the Wine host. This
|
||||
// messaging mechanism is how we relay the VST3 communication protocol. As a
|
||||
// first thing, the Wine VST host will ask us for a copy of the
|
||||
// configuration.
|
||||
host_callback_handler = std::jthread([&]() {
|
||||
// TODO: Handle callbacks
|
||||
// sockets.vst_host_callback.receive_multi();
|
||||
sockets.vst_host_callback.receive_messages(
|
||||
std::pair<Vst3Logger&, bool>(logger, false),
|
||||
[&](CallbackRequest request) -> CallbackResponse {
|
||||
return std::visit(overload{[&](const WantsConfiguration&)
|
||||
-> WantsConfiguration::Response {
|
||||
return config;
|
||||
}},
|
||||
request);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,7 +78,10 @@ class HostBridge {
|
||||
* Wine window, and embedding that Wine window into a window provided by the
|
||||
* host. Should be empty when the editor is not open.
|
||||
*
|
||||
* @see should_postpone_message_loop
|
||||
* TODO: This should be moved back to `Vst2Bridge`, `handle_x11_events()``
|
||||
* and `handle_win32_events()` should be made pure virtual. A single
|
||||
* `Vst3Bridge` instance will handle multiple plugin instances because
|
||||
* of the way VST3 works.
|
||||
*/
|
||||
std::optional<Editor> editor;
|
||||
};
|
||||
|
||||
@@ -63,6 +63,10 @@ class Vst2Bridge : public HostBridge {
|
||||
std::string plugin_dll_path,
|
||||
std::string endpoint_base_dir);
|
||||
|
||||
/**
|
||||
* Here we'll handle incoming `dispatch()` messages until the sockets get
|
||||
* closed during `effClose()`.
|
||||
*/
|
||||
void run() override;
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,16 +45,17 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
|
||||
|
||||
sockets.connect();
|
||||
|
||||
// TODO: We should send a copy of the configuration from the plugin at this
|
||||
// point config = sockets.host_vst_control.receive_single<Configuration>();
|
||||
|
||||
control_handler = Win32Thread([&]() {
|
||||
// TODO: Handle control messages
|
||||
// sockets.host_vst_control.receive_multi();
|
||||
});
|
||||
// Fetch this instance's configuration from the plugin to finish the setup
|
||||
// process
|
||||
config = sockets.vst_host_callback.send_message(WantsConfiguration{},
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
void Vst3Bridge::run() {
|
||||
// TODO: Do something
|
||||
// TODO: Handle events
|
||||
// sockets.host_vst_control.receive_messages(
|
||||
// std::nullopt, [&](ControlRequest request) -> ControlResponse {
|
||||
// });
|
||||
|
||||
std::cerr << "TODO: Not yet implemented" << std::endl;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ class Vst3Bridge : public HostBridge {
|
||||
std::string plugin_dll_path,
|
||||
std::string endpoint_base_dir);
|
||||
|
||||
/**
|
||||
* Here we'll listen for and handle incoming control messages until the
|
||||
* sockets get closed.
|
||||
*/
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
@@ -79,9 +83,4 @@ class Vst3Bridge : public HostBridge {
|
||||
* threads to exit.
|
||||
*/
|
||||
Vst3Sockets<Win32Thread> sockets;
|
||||
|
||||
/**
|
||||
* Handles control messages host over the `hsot_vst_control` sockets.
|
||||
*/
|
||||
Win32Thread control_handler;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user