diff --git a/src/plugin/plugin-bridge.cpp b/src/plugin/plugin-bridge.cpp index 3953f00e..fc9f64af 100644 --- a/src/plugin/plugin-bridge.cpp +++ b/src/plugin/plugin-bridge.cpp @@ -50,9 +50,10 @@ PluginBridge& get_bridge_instance(const AEffect& plugin) { } PluginBridge::PluginBridge(audioMasterCallback host_callback) - : vst_plugin_path(find_vst_plugin()), + : config(Configuration::load_for(get_this_file_location())), + vst_plugin_path(find_vst_plugin()), vst_plugin_arch(find_vst_architecture(vst_plugin_path)), - vst_host_path(find_vst_host(vst_plugin_arch)), + vst_host_path(find_vst_host(vst_plugin_arch, config.group.has_value())), // All the fields should be zero initialized because // `Vst2PluginInstance::vstAudioMasterCallback` from Bitwig's plugin // bridge will crash otherwise @@ -68,7 +69,6 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback) host_callback_function(host_callback), logger(Logger::create_from_environment( create_logger_prefix(socket_endpoint.path()))), - config(Configuration::load_for(get_this_file_location())), wine_version(get_wine_version()), wine_stdout(io_context), wine_stderr(io_context) { diff --git a/src/plugin/plugin-bridge.h b/src/plugin/plugin-bridge.h index e42787b1..6b66ab99 100644 --- a/src/plugin/plugin-bridge.h +++ b/src/plugin/plugin-bridge.h @@ -74,6 +74,14 @@ class PluginBridge { float get_parameter(AEffect* plugin, int index); void set_parameter(AEffect* plugin, int index, float value); + /** + * The configuration for this instance of yabridge. Set based on the values + * from a `yabridge.toml`, if it exists. + * + * @see Configuration::load_for + */ + Configuration config; + /** * The path to the .dll being loaded in the Wine VST host. */ @@ -198,14 +206,6 @@ class PluginBridge { */ Logger logger; - /** - * The configuration for this instance of yabridge. Set based on the values - * from a `yabridge.toml`, if it exists. - * - * @see Configuration::load_for - */ - Configuration config; - /** * The version of Wine currently in use. Used in the debug output on plugin * startup. diff --git a/src/plugin/utils.cpp b/src/plugin/utils.cpp index 2fa192fa..59a1c393 100644 --- a/src/plugin/utils.cpp +++ b/src/plugin/utils.cpp @@ -111,11 +111,12 @@ PluginArchitecture find_vst_architecture(fs::path plugin_path) { throw std::runtime_error(error_msg.str()); } -fs::path find_vst_host(PluginArchitecture plugin_arch) { - // TODO: Take plugin group settings into account - auto host_name = yabridge_individual_host_name; +fs::path find_vst_host(PluginArchitecture plugin_arch, bool use_plugin_groups) { + auto host_name = use_plugin_groups ? yabridge_group_host_name + : yabridge_individual_host_name; if (plugin_arch == PluginArchitecture::vst_32) { - host_name = yabridge_individual_host_name_32bit; + host_name = use_plugin_groups ? yabridge_group_host_name_32bit + : yabridge_individual_host_name_32bit; } fs::path host_path = diff --git a/src/plugin/utils.h b/src/plugin/utils.h index ad481852..3946d008 100644 --- a/src/plugin/utils.h +++ b/src/plugin/utils.h @@ -80,11 +80,14 @@ PluginArchitecture find_vst_architecture(boost::filesystem::path); * * @param plugin_arch The architecture of the plugin, either 64-bit or 32-bit. * Used to determine which host application to use, if available. + * @param use_plugin_groups Whether the plugin is using plugin groups and we + * should be looking for the group host instead of the individual plugin host. * * @return The a path to the VST host, if found. * @throw std::runtime_error If the Wine VST host could not be found. */ -boost::filesystem::path find_vst_host(PluginArchitecture plugin_arch); +boost::filesystem::path find_vst_host(PluginArchitecture plugin_arch, + bool use_plugin_groups); /** * Find the VST plugin .dll file that corresponds to this copy of