mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Add way to use 32-bit VST3 when both are installed
Otherwise we would always use the 64-bit version and there would be no way to use the 32-bit version, if version for some reason works better. Relates to #80.
This commit is contained in:
+15
-12
@@ -59,12 +59,12 @@ class PluginBridge {
|
||||
*/
|
||||
template <typename F>
|
||||
PluginBridge(PluginType plugin_type, F create_socket_instance)
|
||||
: info(plugin_type),
|
||||
// This is still correct for VST3 plugins because we can configure an
|
||||
// entire directory (the module's bundle) at once
|
||||
: config(load_config_for(get_this_file_location())),
|
||||
info(plugin_type, config.vst3_prefer_32bit),
|
||||
io_context(),
|
||||
sockets(create_socket_instance(io_context, info)),
|
||||
// This is still correct for VST3 plugins because we can configure an
|
||||
// entire directory (the module's bundle) at once
|
||||
config(load_config_for(info.native_library_path)),
|
||||
generic_logger(Logger::create_from_environment(
|
||||
create_logger_prefix(sockets.base_dir))),
|
||||
plugin_host(
|
||||
@@ -196,6 +196,9 @@ class PluginBridge {
|
||||
if (config.vst3_no_scaling) {
|
||||
other_options.push_back("vst3: no GUI scaling");
|
||||
}
|
||||
if (config.vst3_prefer_32bit) {
|
||||
other_options.push_back("vst3: prefer 32-bit");
|
||||
}
|
||||
if (!other_options.empty()) {
|
||||
init_msg << join_quoted_strings(other_options) << std::endl;
|
||||
} else {
|
||||
@@ -279,6 +282,14 @@ class PluginBridge {
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* The configuration for this instance of yabridge. Set based on the values
|
||||
* from a `yabridge.toml`, if it exists.
|
||||
*
|
||||
* @see ../utils.h:load_config_for
|
||||
*/
|
||||
Configuration config;
|
||||
|
||||
/**
|
||||
* Information about the plugin we're bridging.
|
||||
*/
|
||||
@@ -296,14 +307,6 @@ class PluginBridge {
|
||||
*/
|
||||
TSockets sockets;
|
||||
|
||||
/**
|
||||
* The configuration for this instance of yabridge. Set based on the values
|
||||
* from a `yabridge.toml`, if it exists.
|
||||
*
|
||||
* @see ../utils.h:load_config_for
|
||||
*/
|
||||
Configuration config;
|
||||
|
||||
/**
|
||||
* The logging facility used for this instance of yabridge. See
|
||||
* `Logger::create_from_env()` for how this is configured.
|
||||
|
||||
+25
-20
@@ -36,21 +36,23 @@ namespace fs = boost::filesystem;
|
||||
// docstrings for the corresponding fields for more information on what we're
|
||||
// actually doing here.
|
||||
fs::path find_plugin_library(const fs::path& this_plugin_path,
|
||||
PluginType plugin_type);
|
||||
PluginType plugin_type,
|
||||
bool prefer_32bit_vst3);
|
||||
fs::path normalize_plugin_path(const fs::path& windows_library_path,
|
||||
PluginType plugin_type);
|
||||
std::variant<OverridenWinePrefix, fs::path, DefaultWinePrefix> find_wine_prefix(
|
||||
fs::path windows_plugin_path);
|
||||
|
||||
PluginInfo::PluginInfo(PluginType plugin_type)
|
||||
PluginInfo::PluginInfo(PluginType plugin_type, bool prefer_32bit_vst3)
|
||||
: plugin_type(plugin_type),
|
||||
native_library_path(get_this_file_location()),
|
||||
// As explained in the docstring, this is the actual Windows library. For
|
||||
// VST3 plugins that come in a module we should be loading that module
|
||||
// instead of the `.vst3` file within in, which is where
|
||||
// `windows_plugin_path` comes in.
|
||||
windows_library_path(
|
||||
find_plugin_library(native_library_path, plugin_type)),
|
||||
windows_library_path(find_plugin_library(native_library_path,
|
||||
plugin_type,
|
||||
prefer_32bit_vst3)),
|
||||
plugin_arch(find_dll_architecture(windows_library_path)),
|
||||
windows_plugin_path(
|
||||
normalize_plugin_path(windows_library_path, plugin_type)),
|
||||
@@ -88,7 +90,8 @@ boost::filesystem::path PluginInfo::normalize_wine_prefix() const {
|
||||
}
|
||||
|
||||
fs::path find_plugin_library(const fs::path& this_plugin_path,
|
||||
PluginType plugin_type) {
|
||||
PluginType plugin_type,
|
||||
bool prefer_32bit_vst3) {
|
||||
switch (plugin_type) {
|
||||
case PluginType::vst2: {
|
||||
fs::path plugin_path(this_plugin_path);
|
||||
@@ -141,29 +144,31 @@ fs::path find_plugin_library(const fs::path& this_plugin_path,
|
||||
// Finding the Windows plugin consists of two steps because
|
||||
// Steinberg changed the format around:
|
||||
// - First we'll find the plugin in the VST3 bundle created by
|
||||
// yabridgectl in `~/.vst3`. The plugin can be either 32-bit or
|
||||
// 64-bit.
|
||||
// TODO: Right now we can't select between the 64-bit and the
|
||||
// 32-bit version and we'll just pick whichever one is
|
||||
// available
|
||||
// yabridgectl in `~/.vst3/yabridge`. The plugin can be either
|
||||
// 32-bit or 64-bit. If both exist, then we'll take the 64-bit
|
||||
// version, unless the `vst3_prefer_32bit` yabridge.toml option
|
||||
// has been enabled for this plugin.
|
||||
// - After that we'll resolve the symlink to the module in the Wine
|
||||
// prefix, and then we'll have to figure out if this module is an
|
||||
// old style standalone module (< 3.6.10) or if it's inside of
|
||||
// a bundle (>= 3.6.10)
|
||||
fs::path candidate_path =
|
||||
const fs::path candidate_path_64bit =
|
||||
bundle_home / "Contents" / "x86_64-win" / win_module_name;
|
||||
if (!fs::exists(candidate_path)) {
|
||||
// Try the 32-bit version no 64-bit version exists (although, is
|
||||
// there a single VST3 plugin where this is the case?)
|
||||
candidate_path =
|
||||
bundle_home / "Contents" / "x86-win" / win_module_name;
|
||||
}
|
||||
const fs::path candidate_path_32bit =
|
||||
bundle_home / "Contents" / "x86-win" / win_module_name;
|
||||
|
||||
// After this we'll have to use `normalize_plugin_path()` to get the
|
||||
// actual module entry point in case the plugin is using a VST
|
||||
// 3.6.10 style bundle
|
||||
if (fs::exists(candidate_path)) {
|
||||
return fs::canonical(candidate_path);
|
||||
// 3.6.10 style bundle, because we need to inspect that for the
|
||||
// _actual_ (with yabridgectl `x86_64-win` should only contain a
|
||||
// 64-bit plugin and `x86-win` should only contain a 32-bit plugin,
|
||||
// but you never know!)
|
||||
if (prefer_32bit_vst3 && fs::exists(candidate_path_32bit)) {
|
||||
return fs::canonical(candidate_path_32bit);
|
||||
} else if (fs::exists(candidate_path_64bit)) {
|
||||
return fs::canonical(candidate_path_64bit);
|
||||
} else if (fs::exists(candidate_path_32bit)) {
|
||||
return fs::canonical(candidate_path_32bit);
|
||||
}
|
||||
|
||||
throw std::runtime_error(
|
||||
|
||||
+4
-6
@@ -56,19 +56,17 @@ struct PluginInfo {
|
||||
* we'll have yabridgectl create a 'merged bundle' that also contains the
|
||||
* Windows VST3 plugin.
|
||||
*
|
||||
* TODO: At the moment we can't choose to use the 32-bit VST3 if a 64-bit
|
||||
* plugin exists. Potential solutions are to add a config option to
|
||||
* use the 32-bit version, or we can add a filename suffix to all
|
||||
* 32-bit versions so they can live alongside each other.
|
||||
*
|
||||
* @param plugin_type The type of the plugin we're going to load. The
|
||||
* detection works slightly differently depending on the plugin type.
|
||||
* @param prefer_32bit_vst3 If there's both a 64-bit and a 32-bit Windows
|
||||
* VST3 module in the same bundle, then setting this to true will cause
|
||||
* the 32-bit version to be used instead of the 64-bit version.
|
||||
*
|
||||
* @throw std::runtime_error If we cannot find a corresponding Windows
|
||||
* plugin. The error message contains a human readable description of what
|
||||
* went wrong.
|
||||
*/
|
||||
PluginInfo(PluginType plugin_type);
|
||||
PluginInfo(PluginType plugin_type, bool prefer_32bit_vst3 = false);
|
||||
|
||||
/**
|
||||
* Create the environment for the plugin host based on `wine_prefix`. If
|
||||
|
||||
Reference in New Issue
Block a user