mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 12:30:00 +02:00
Change terminology from 'VST' to 'plugin'
This commit is contained in:
@@ -591,7 +591,7 @@ class AdHocSocketHandler {
|
||||
// As mentioned in `acceptor's` docstring, this acceptor will be
|
||||
// recreated in `receive_multi()` on another context, and
|
||||
// potentially on the other side of the connection in the case
|
||||
// where we're handling `vst_host_callback_` VST2 events
|
||||
// where we're handling `plugin_host_callback_` VST2 events
|
||||
acceptor_.reset();
|
||||
ghc::filesystem::remove(endpoint_.path());
|
||||
} else {
|
||||
@@ -869,10 +869,10 @@ class AdHocSocketHandler {
|
||||
* during `Sockets::connect()`. When `AdHocSocketHandler::receive_multi()`
|
||||
* is then called, we'll recreate the acceptor to asynchronously listen for
|
||||
* new incoming socket connections on `endpoint` using. This is important,
|
||||
* because on the case of `Vst2Sockets`'s' `vst_host_callback_` the acceptor
|
||||
* is first accepts an initial socket on the plugin side (like all sockets),
|
||||
* but all additional incoming connections of course have to be listened for
|
||||
* on the plugin side.
|
||||
* because on the case of `Vst2Sockets`'s' `plugin_host_callback_` the
|
||||
* acceptor is first accepts an initial socket on the plugin side (like all
|
||||
* sockets), but all additional incoming connections of course have to be
|
||||
* listened for on the plugin side.
|
||||
*/
|
||||
std::optional<asio::local::stream_protocol::acceptor> acceptor_;
|
||||
|
||||
@@ -1010,8 +1010,8 @@ class TypedMessageHandler : public AdHocSocketHandler<Thread> {
|
||||
// only print the responses when the request was not filtered out.
|
||||
bool should_log_response = false;
|
||||
if (logging) {
|
||||
auto [logger, is_host_vst] = *logging;
|
||||
should_log_response = logger.log_request(is_host_vst, object);
|
||||
auto [logger, is_host_plugin] = *logging;
|
||||
should_log_response = logger.log_request(is_host_plugin, object);
|
||||
}
|
||||
|
||||
// A socket only handles a single request at a time as to prevent
|
||||
@@ -1024,8 +1024,8 @@ class TypedMessageHandler : public AdHocSocketHandler<Thread> {
|
||||
});
|
||||
|
||||
if (should_log_response) {
|
||||
auto [logger, is_host_vst] = *logging;
|
||||
logger.log_response(!is_host_vst, response_object);
|
||||
auto [logger, is_host_plugin] = *logging;
|
||||
logger.log_response(!is_host_plugin, response_object);
|
||||
}
|
||||
|
||||
return response_object;
|
||||
@@ -1111,8 +1111,8 @@ class TypedMessageHandler : public AdHocSocketHandler<Thread> {
|
||||
if (logging) {
|
||||
should_log_response = std::visit(
|
||||
[&](const auto& object) {
|
||||
auto [logger, is_host_vst] = *logging;
|
||||
return logger.log_request(is_host_vst, object);
|
||||
auto [logger, is_host_plugin] = *logging;
|
||||
return logger.log_request(is_host_plugin, object);
|
||||
},
|
||||
// In the case of `AudioProcessorRequest`, we need to
|
||||
// actually fetch the variant field since our object
|
||||
@@ -1130,8 +1130,8 @@ class TypedMessageHandler : public AdHocSocketHandler<Thread> {
|
||||
typename T::Response response = callback(object);
|
||||
|
||||
if (should_log_response) {
|
||||
auto [logger, is_host_vst] = *logging;
|
||||
logger.log_response(!is_host_vst, response);
|
||||
auto [logger, is_host_plugin] = *logging;
|
||||
logger.log_response(!is_host_plugin, response);
|
||||
}
|
||||
|
||||
if constexpr (persistent_buffers) {
|
||||
|
||||
@@ -322,8 +322,8 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
|
||||
* Wine host when hosting a VST2 plugin.
|
||||
*
|
||||
* On the plugin side this class should be initialized with `listen` set to
|
||||
* `true` before launching the Wine VST host. This will start listening on the
|
||||
* sockets, and the call to `connect()` will then accept any incoming
|
||||
* `true` before launching the Wine plugin host. This will start listening on
|
||||
* the sockets, and the call to `connect()` will then accept any incoming
|
||||
* connections.
|
||||
*
|
||||
* @tparam Thread The thread implementation to use. On the Linux side this
|
||||
@@ -350,76 +350,79 @@ class Vst2Sockets final : public Sockets {
|
||||
const ghc::filesystem::path& endpoint_base_dir,
|
||||
bool listen)
|
||||
: Sockets(endpoint_base_dir),
|
||||
host_vst_dispatch_(io_context,
|
||||
(base_dir_ / "host_vst_dispatch.sock").string(),
|
||||
listen),
|
||||
vst_host_callback_(io_context,
|
||||
(base_dir_ / "vst_host_callback.sock").string(),
|
||||
listen),
|
||||
host_vst_parameters_(
|
||||
host_plugin_dispatch_(
|
||||
io_context,
|
||||
(base_dir_ / "host_vst_parameters.sock").string(),
|
||||
(base_dir_ / "host_plugin_dispatch.sock").string(),
|
||||
listen),
|
||||
host_vst_process_replacing_(
|
||||
plugin_host_callback_(
|
||||
io_context,
|
||||
(base_dir_ / "host_vst_process_replacing.sock").string(),
|
||||
(base_dir_ / "plugin_host_callback.sock").string(),
|
||||
listen),
|
||||
host_vst_control_(io_context,
|
||||
(base_dir_ / "host_vst_control.sock").string(),
|
||||
listen) {}
|
||||
host_plugin_parameters_(
|
||||
io_context,
|
||||
(base_dir_ / "host_plugin_parameters.sock").string(),
|
||||
listen),
|
||||
host_plugin_process_replacing_(
|
||||
io_context,
|
||||
(base_dir_ / "host_plugin_process_replacing.sock").string(),
|
||||
listen),
|
||||
host_plugin_control_(
|
||||
io_context,
|
||||
(base_dir_ / "host_plugin_control.sock").string(),
|
||||
listen) {}
|
||||
|
||||
~Vst2Sockets() noexcept override { close(); }
|
||||
|
||||
void connect() override {
|
||||
host_vst_dispatch_.connect();
|
||||
vst_host_callback_.connect();
|
||||
host_vst_parameters_.connect();
|
||||
host_vst_process_replacing_.connect();
|
||||
host_vst_control_.connect();
|
||||
host_plugin_dispatch_.connect();
|
||||
plugin_host_callback_.connect();
|
||||
host_plugin_parameters_.connect();
|
||||
host_plugin_process_replacing_.connect();
|
||||
host_plugin_control_.connect();
|
||||
}
|
||||
|
||||
void close() override {
|
||||
// Manually close all sockets so we break out of any blocking operations
|
||||
// that may still be active
|
||||
host_vst_dispatch_.close();
|
||||
vst_host_callback_.close();
|
||||
host_vst_parameters_.close();
|
||||
host_vst_process_replacing_.close();
|
||||
host_vst_control_.close();
|
||||
host_plugin_dispatch_.close();
|
||||
plugin_host_callback_.close();
|
||||
host_plugin_parameters_.close();
|
||||
host_plugin_process_replacing_.close();
|
||||
host_plugin_control_.close();
|
||||
}
|
||||
|
||||
// The naming convention for these sockets is `<from>_<to>_<event>`. For
|
||||
// instance the socket named `host_vst_dispatch` forwards
|
||||
// instance the socket named `host_plugin_dispatch` forwards
|
||||
// `AEffect.dispatch()` calls from the native VST host to the Windows VST
|
||||
// plugin (through the Wine VST host).
|
||||
// plugin (through the Wine plugin host).
|
||||
|
||||
/**
|
||||
* The socket that forwards all `dispatcher()` calls from the VST host to
|
||||
* the plugin.
|
||||
*/
|
||||
Vst2EventHandler<Thread> host_vst_dispatch_;
|
||||
Vst2EventHandler<Thread> host_plugin_dispatch_;
|
||||
/**
|
||||
* The socket that forwards all `audioMaster()` calls from the Windows VST
|
||||
* plugin to the host.
|
||||
*/
|
||||
Vst2EventHandler<Thread> vst_host_callback_;
|
||||
Vst2EventHandler<Thread> plugin_host_callback_;
|
||||
/**
|
||||
* Used for both `getParameter` and `setParameter` since they mostly
|
||||
* overlap.
|
||||
*/
|
||||
SocketHandler host_vst_parameters_;
|
||||
SocketHandler host_plugin_parameters_;
|
||||
/**
|
||||
* Used for processing audio usign the `process()`, `processReplacing()` and
|
||||
* `processDoubleReplacing()` functions.
|
||||
*/
|
||||
SocketHandler host_vst_process_replacing_;
|
||||
SocketHandler host_plugin_process_replacing_;
|
||||
/**
|
||||
* A control socket that sends data that is not suitable for the other
|
||||
* sockets. At the moment this is only used to, on startup, send the Windows
|
||||
* VST plugin's `AEffect` object to the native VST plugin, and to then send
|
||||
* the configuration (from `config_`) back to the Wine host.
|
||||
*/
|
||||
SocketHandler host_vst_control_;
|
||||
SocketHandler host_plugin_control_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
* Wine host when hosting a VST3 plugin.
|
||||
*
|
||||
* On the plugin side this class should be initialized with `listen` set to
|
||||
* `true` before launching the Wine VST host. This will start listening on the
|
||||
* sockets, and the call to `connect()` will then accept any incoming
|
||||
* `true` before launching the Wine plugin host. This will start listening on
|
||||
* the sockets, and the call to `connect()` will then accept any incoming
|
||||
* connections.
|
||||
*
|
||||
* We'll have a host -> plugin connection for sending control messages (which is
|
||||
@@ -66,27 +66,29 @@ class Vst3Sockets final : public Sockets {
|
||||
const ghc::filesystem::path& endpoint_base_dir,
|
||||
bool listen)
|
||||
: Sockets(endpoint_base_dir),
|
||||
host_vst_control_(io_context,
|
||||
(base_dir_ / "host_vst_control.sock").string(),
|
||||
listen),
|
||||
vst_host_callback_(io_context,
|
||||
(base_dir_ / "vst_host_callback.sock").string(),
|
||||
listen),
|
||||
host_plugin_control_(
|
||||
io_context,
|
||||
(base_dir_ / "host_plugin_control.sock").string(),
|
||||
listen),
|
||||
plugin_host_callback_(
|
||||
io_context,
|
||||
(base_dir_ / "plugin_host_callback.sock").string(),
|
||||
listen),
|
||||
io_context_(io_context) {}
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)
|
||||
~Vst3Sockets() noexcept override { close(); }
|
||||
|
||||
void connect() override {
|
||||
host_vst_control_.connect();
|
||||
vst_host_callback_.connect();
|
||||
host_plugin_control_.connect();
|
||||
plugin_host_callback_.connect();
|
||||
}
|
||||
|
||||
void close() override {
|
||||
// Manually close all sockets so we break out of any blocking operations
|
||||
// that may still be active
|
||||
host_vst_control_.close();
|
||||
vst_host_callback_.close();
|
||||
host_plugin_control_.close();
|
||||
plugin_host_callback_.close();
|
||||
|
||||
// This map should be empty at this point, but who knows
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
@@ -106,7 +108,7 @@ class Vst3Sockets final : public Sockets {
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
audio_processor_sockets_.try_emplace(
|
||||
instance_id, io_context_,
|
||||
(base_dir_ / ("host_vst_audio_processor_" +
|
||||
(base_dir_ / ("host_plugin_audio_processor_" +
|
||||
std::to_string(instance_id) + ".sock"))
|
||||
.string(),
|
||||
false);
|
||||
@@ -140,7 +142,7 @@ class Vst3Sockets final : public Sockets {
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
audio_processor_sockets_.try_emplace(
|
||||
instance_id, io_context_,
|
||||
(base_dir_ / ("host_vst_audio_processor_" +
|
||||
(base_dir_ / ("host_plugin_audio_processor_" +
|
||||
std::to_string(instance_id) + ".sock"))
|
||||
.string(),
|
||||
true);
|
||||
@@ -237,14 +239,16 @@ class Vst3Sockets final : public Sockets {
|
||||
* This will be listened on by the Wine plugin host when it calls
|
||||
* `receive_multi()`.
|
||||
*/
|
||||
TypedMessageHandler<Thread, Vst3Logger, ControlRequest> host_vst_control_;
|
||||
TypedMessageHandler<Thread, Vst3Logger, ControlRequest>
|
||||
host_plugin_control_;
|
||||
|
||||
/**
|
||||
* For sending callbacks from the plugin back to the host. After we have a
|
||||
* better idea of what our communication model looks like we'll probably
|
||||
* want to provide an abstraction similar to `Vst2EventHandler`.
|
||||
*/
|
||||
TypedMessageHandler<Thread, Vst3Logger, CallbackRequest> vst_host_callback_;
|
||||
TypedMessageHandler<Thread, Vst3Logger, CallbackRequest>
|
||||
plugin_host_callback_;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user