mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Change terminology from 'VST' to 'plugin'
This commit is contained in:
+12
-12
@@ -77,7 +77,7 @@ Vst2PluginBridge::Vst2PluginBridge(const ghc::filesystem::path& plugin_path,
|
||||
set_realtime_priority(true);
|
||||
pthread_setname_np(pthread_self(), "host-callbacks");
|
||||
|
||||
sockets_.vst_host_callback_.receive_events(
|
||||
sockets_.plugin_host_callback_.receive_events(
|
||||
std::pair<Vst2Logger&, bool>(logger_, false),
|
||||
[&](Vst2Event& event, bool /*on_main_thread*/) {
|
||||
switch (event.opcode) {
|
||||
@@ -178,7 +178,7 @@ Vst2PluginBridge::Vst2PluginBridge(const ghc::filesystem::path& plugin_path,
|
||||
// over the `dispatcher()` socket. This would happen whenever the plugin
|
||||
// calls `audioMasterIOChanged()` and after the host calls `effOpen()`.
|
||||
const auto initialization_data =
|
||||
sockets_.host_vst_control_.receive_single<Vst2EventResult>();
|
||||
sockets_.host_plugin_control_.receive_single<Vst2EventResult>();
|
||||
|
||||
const auto initialized_plugin =
|
||||
std::get<AEffect>(initialization_data.payload);
|
||||
@@ -188,7 +188,7 @@ Vst2PluginBridge::Vst2PluginBridge(const ghc::filesystem::path& plugin_path,
|
||||
|
||||
// After receiving the `AEffect` values we'll want to send the configuration
|
||||
// back to complete the startup process
|
||||
sockets_.host_vst_control_.send(config_);
|
||||
sockets_.host_plugin_control_.send(config_);
|
||||
|
||||
update_aeffect(plugin_, initialized_plugin);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ class DispatchDataConverter : public DefaultDataConverter {
|
||||
break;
|
||||
case effEditOpen:
|
||||
// The host will have passed us an X11 window handle in the void
|
||||
// pointer. In the Wine VST host we'll create a Win32 window,
|
||||
// pointer. In the Wine plugin host we'll create a Win32 window,
|
||||
// ask the plugin to embed itself in that and then embed that
|
||||
// window into this X11 window handle.
|
||||
return reinterpret_cast<size_t>(data);
|
||||
@@ -541,7 +541,7 @@ intptr_t Vst2PluginBridge::dispatch(AEffect* /*plugin*/,
|
||||
intptr_t return_value = 0;
|
||||
try {
|
||||
// TODO: Add some kind of timeout?
|
||||
return_value = sockets_.host_vst_dispatch_.send_event(
|
||||
return_value = sockets_.host_plugin_dispatch_.send_event(
|
||||
converter, std::pair<Vst2Logger&, bool>(logger_, true),
|
||||
opcode, index, value, data, option);
|
||||
} catch (const std::system_error&) {
|
||||
@@ -617,7 +617,7 @@ intptr_t Vst2PluginBridge::dispatch(AEffect* /*plugin*/,
|
||||
// and loading plugin state it's much better to have bitsery or our
|
||||
// receiving function temporarily allocate a large enough buffer rather than
|
||||
// to have a bunch of allocated memory sitting around doing nothing.
|
||||
return sockets_.host_vst_dispatch_.send_event(
|
||||
return sockets_.host_plugin_dispatch_.send_event(
|
||||
converter, std::pair<Vst2Logger&, bool>(logger_, true), opcode, index,
|
||||
value, data, option);
|
||||
}
|
||||
@@ -692,12 +692,12 @@ void Vst2PluginBridge::do_process(T** inputs, T** outputs, int sample_frames) {
|
||||
// After writing audio to the shared memory buffers, we'll send the
|
||||
// processing request parameters to the Wine plugin host so it can start
|
||||
// processing audio. This is why we don't need any explicit synchronisation.
|
||||
sockets_.host_vst_process_replacing_.send(request);
|
||||
sockets_.host_plugin_process_replacing_.send(request);
|
||||
|
||||
// From the Wine side we'll send a zero byte struct back as an
|
||||
// acknowledgement that audio processing has finished. At this point the
|
||||
// audio will have been written to our buffers.
|
||||
sockets_.host_vst_process_replacing_.receive_single<Ack>();
|
||||
sockets_.host_plugin_process_replacing_.receive_single<Ack>();
|
||||
|
||||
for (int channel = 0; channel < plugin_.numOutputs; channel++) {
|
||||
const T* output_channel =
|
||||
@@ -777,10 +777,10 @@ float Vst2PluginBridge::get_parameter(AEffect* /*plugin*/, int index) {
|
||||
// called at the same time since they share the same socket
|
||||
{
|
||||
std::lock_guard lock(parameters_mutex_);
|
||||
sockets_.host_vst_parameters_.send(request);
|
||||
sockets_.host_plugin_parameters_.send(request);
|
||||
|
||||
response =
|
||||
sockets_.host_vst_parameters_.receive_single<ParameterResult>();
|
||||
sockets_.host_plugin_parameters_.receive_single<ParameterResult>();
|
||||
}
|
||||
|
||||
logger_.log_get_parameter_response(*response.value);
|
||||
@@ -798,10 +798,10 @@ void Vst2PluginBridge::set_parameter(AEffect* /*plugin*/,
|
||||
|
||||
{
|
||||
std::lock_guard lock(parameters_mutex_);
|
||||
sockets_.host_vst_parameters_.send(request);
|
||||
sockets_.host_plugin_parameters_.send(request);
|
||||
|
||||
response =
|
||||
sockets_.host_vst_parameters_.receive_single<ParameterResult>();
|
||||
sockets_.host_plugin_parameters_.receive_single<ParameterResult>();
|
||||
}
|
||||
|
||||
logger_.log_set_parameter_response();
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
/**
|
||||
* This handles the communication between the Linux native VST2 plugin and the
|
||||
* Wine VST host. The functions below should be used as callback functions in an
|
||||
* `AEffect` object.
|
||||
* Wine plugin host. The functions below should be used as callback functions in
|
||||
* an `AEffect` object.
|
||||
*
|
||||
* The naming scheme of all of these 'bridge' classes is `<type>{,Plugin}Bridge`
|
||||
* for greppability reasons. The `Plugin` infix is added on the native plugin
|
||||
|
||||
@@ -46,13 +46,13 @@ Vst3PluginBridge::Vst3PluginBridge(const ghc::filesystem::path& plugin_path)
|
||||
// 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
|
||||
// first thing, the Wine plugin host will ask us for a copy of the
|
||||
// configuration.
|
||||
host_callback_handler_ = std::jthread([&]() {
|
||||
set_realtime_priority(true);
|
||||
pthread_setname_np(pthread_self(), "host-callbacks");
|
||||
|
||||
sockets_.vst_host_callback_.receive_messages(
|
||||
sockets_.plugin_host_callback_.receive_messages(
|
||||
std::pair<Vst3Logger&, bool>(logger_, false),
|
||||
overload{
|
||||
[&](const Vst3ContextMenuProxy::Destruct& request)
|
||||
@@ -435,7 +435,7 @@ Steinberg::IPluginFactory* Vst3PluginBridge::get_plugin_factory() {
|
||||
// have started before this since the Wine plugin host will request a
|
||||
// copy of the configuration during its initialization.
|
||||
Vst3PluginFactoryProxy::ConstructArgs factory_args =
|
||||
sockets_.host_vst_control_.send_message(
|
||||
sockets_.host_plugin_control_.send_message(
|
||||
Vst3PluginFactoryProxy::Construct{},
|
||||
std::pair<Vst3Logger&, bool>(logger_, true));
|
||||
plugin_factory_ = Steinberg::owned(
|
||||
|
||||
@@ -117,15 +117,15 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
|
||||
/**
|
||||
* Send a control message to the Wine plugin host and return the response.
|
||||
* This is a shorthand for `sockets_.host_vst_control_.send_message()` for
|
||||
* use in VST3 interface implementations. This is mostly used for main
|
||||
* This is a shorthand for `sockets_.host_plugin_control_.send_message()`
|
||||
* for use in VST3 interface implementations. This is mostly used for main
|
||||
* thread messages but outside of the situations where plugins will crash or
|
||||
* misbehave thread guarantees are not always upheld in yabridge's VST3
|
||||
* implementation.
|
||||
*/
|
||||
template <typename T>
|
||||
typename T::Response send_message(const T& object) {
|
||||
return sockets_.host_vst_control_.send_message(
|
||||
return sockets_.host_plugin_control_.send_message(
|
||||
object, std::pair<Vst3Logger&, bool>(logger_, true));
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
|
||||
private:
|
||||
/**
|
||||
* Handles callbacks from the plugin to the host over the
|
||||
* `vst_host_callback_` sockets.
|
||||
* `plugin_host_callback_` sockets.
|
||||
*/
|
||||
std::jthread host_callback_handler_;
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ IndividualHost::IndividualHost(asio::io_context& io_context,
|
||||
const HostRequest& host_request)
|
||||
: HostProcess(io_context, sockets),
|
||||
plugin_info_(plugin_info),
|
||||
host_path_(find_vst_host(plugin_info.native_library_path_,
|
||||
plugin_info.plugin_arch_)),
|
||||
host_path_(find_plugin_host(plugin_info.native_library_path_,
|
||||
plugin_info.plugin_arch_)),
|
||||
handle_(launch_host(
|
||||
host_path_,
|
||||
{
|
||||
@@ -168,8 +168,8 @@ GroupHost::GroupHost(asio::io_context& io_context,
|
||||
const HostRequest& host_request)
|
||||
: HostProcess(io_context, sockets),
|
||||
plugin_info_(plugin_info),
|
||||
host_path_(find_vst_host(plugin_info.native_library_path_,
|
||||
plugin_info.plugin_arch_)) {
|
||||
host_path_(find_plugin_host(plugin_info.native_library_path_,
|
||||
plugin_info.plugin_arch_)) {
|
||||
// When using plugin groups, we'll first try to connect to an existing group
|
||||
// host process and ask it to host our plugin. If no such process exists,
|
||||
// then we'll start a new process. In the event that multiple yabridge
|
||||
|
||||
@@ -307,8 +307,8 @@ std::string create_logger_prefix(const fs::path& endpoint_base_dir) {
|
||||
return "[" + endpoint_name + "] ";
|
||||
}
|
||||
|
||||
fs::path find_vst_host(const ghc::filesystem::path& this_plugin_path,
|
||||
LibArchitecture plugin_arch) {
|
||||
fs::path find_plugin_host(const ghc::filesystem::path& this_plugin_path,
|
||||
LibArchitecture plugin_arch) {
|
||||
auto host_name = yabridge_host_name;
|
||||
if (plugin_arch == LibArchitecture::dll_32) {
|
||||
host_name = yabridge_host_name_32bit;
|
||||
@@ -322,9 +322,9 @@ fs::path find_vst_host(const ghc::filesystem::path& this_plugin_path,
|
||||
return host_path;
|
||||
}
|
||||
|
||||
if (const std::optional<fs::path> vst_host_path =
|
||||
if (const std::optional<fs::path> plugin_host_path =
|
||||
search_in_path(get_augmented_search_path(), host_name)) {
|
||||
return *vst_host_path;
|
||||
return *plugin_host_path;
|
||||
} else {
|
||||
throw std::runtime_error("Could not locate '" + std::string(host_name) +
|
||||
"'");
|
||||
|
||||
+16
-14
@@ -45,8 +45,9 @@ struct PluginInfo {
|
||||
public:
|
||||
/**
|
||||
* Locate the Windows plugin based on the location of this copy of
|
||||
* `libyabridge-{clap,vst2,vst3}.so` file and the type of the plugin we're going
|
||||
* to load. For VST2 plugins this is a file with the same name but with a
|
||||
* `libyabridge-{clap,vst2,vst3}.so` file and the type of the plugin we're
|
||||
* going to load. For VST2 plugins this is a file with the same name but
|
||||
* with a
|
||||
* `.dll` file extension instead of `.so`. In case this file does not exist
|
||||
* and the `.so` file is a symlink, we'll also repeat this check for the
|
||||
* file it links to. This is to support the workflow described in issue #3
|
||||
@@ -181,13 +182,14 @@ std::string create_logger_prefix(
|
||||
const ghc::filesystem::path& endpoint_base_dir);
|
||||
|
||||
/**
|
||||
* Finds the Wine VST host (either `yabridge-host.exe` or `yabridge-host-32.exe`
|
||||
* depending on the plugin). For this we will search in two places:
|
||||
* Finds the Wine plugin host (either `yabridge-host.exe` or
|
||||
* `yabridge-host-32.exe` depending on the plugin). For this we will search in
|
||||
* two places:
|
||||
*
|
||||
* 1. Alongside libyabridge-{clap,vst2,vst3}.so if the file got symlinked. This is
|
||||
* useful when developing, as you can simply symlink the
|
||||
* `libyabridge-{clap,vst2,vst3}.so` file in the build directory without having
|
||||
* to install anything to /usr.
|
||||
* 1. Alongside libyabridge-{clap,vst2,vst3}.so if the file got symlinked.
|
||||
* This is useful when developing, as you can simply symlink the
|
||||
* `libyabridge-{clap,vst2,vst3}.so` file in the build directory without
|
||||
* having to install anything to /usr.
|
||||
* 2. In the regular search path, augmented with `~/.local/share/yabridge` to
|
||||
* ease the setup process.
|
||||
*
|
||||
@@ -197,9 +199,9 @@ std::string create_logger_prefix(
|
||||
* Used to determine which host application to use, if available.
|
||||
*
|
||||
* @return The a path to the VST host, if found.
|
||||
* @throw std::runtime_error If the Wine VST host could not be found.
|
||||
* @throw std::runtime_error If the Wine plugin host could not be found.
|
||||
*/
|
||||
ghc::filesystem::path find_vst_host(
|
||||
ghc::filesystem::path find_plugin_host(
|
||||
const ghc::filesystem::path& this_plugin_path,
|
||||
LibArchitecture plugin_arch);
|
||||
|
||||
@@ -228,10 +230,10 @@ ghc::filesystem::path generate_group_endpoint(
|
||||
|
||||
/**
|
||||
* Load the configuration that belongs to a copy of or symlink to
|
||||
* `libyabridge-{clap,vst2,vst3}.so`. If no configuration file could be found then
|
||||
* this will return an empty configuration object with default settings. See the
|
||||
* docstrong on the `Configuration` class for more details on how to choose the
|
||||
* config file to load.
|
||||
* `libyabridge-{clap,vst2,vst3}.so`. If no configuration file could be found
|
||||
* then this will return an empty configuration object with default settings.
|
||||
* See the docstrong on the `Configuration` class for more details on how to
|
||||
* choose the config file to load.
|
||||
*
|
||||
* This function will take any optional compile-time features that have not been
|
||||
* enabled into account.
|
||||
|
||||
Reference in New Issue
Block a user