diff --git a/src/plugin/bridges/common.h b/src/plugin/bridges/common.h index 578186f2..77753f43 100644 --- a/src/plugin/bridges/common.h +++ b/src/plugin/bridges/common.h @@ -82,13 +82,13 @@ class PluginBridge { const ghc::filesystem::path& plugin_path, F&& create_socket_instance) : io_context_(), + // This works for both individual files (VST2 and CLAP) and entire + // directories (VST3) + config_(load_config_for(plugin_path)), + info_(plugin_type, plugin_path, config_.vst3_prefer_32bit), sockets_(create_socket_instance(io_context_, info_)), generic_logger_(Logger::create_from_environment( create_logger_prefix(sockets_.base_dir_))), - // This works for both individual files (VST2 and CLAP) and entire - // directories (VST3) - config_(load_config_for(plugin_path, generic_logger_)), - info_(plugin_type, plugin_path, config_.vst3_prefer_32bit), plugin_host_( config_.group ? std::unique_ptr(std::make_unique( @@ -440,6 +440,19 @@ class PluginBridge { asio::io_context io_context_; + /** + * 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. + */ + const PluginInfo info_; + /** * The sockets used for communication with the Wine process. * @@ -458,19 +471,6 @@ class PluginBridge { */ Logger generic_logger_; - /** - * 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. - */ - const PluginInfo info_; - /** * The Wine process hosting our plugins. In the case of group hosts a * `PluginBridge` instance doesn't actually own a process, but rather either diff --git a/src/plugin/utils.cpp b/src/plugin/utils.cpp index 65f3189c..82db99a5 100644 --- a/src/plugin/utils.cpp +++ b/src/plugin/utils.cpp @@ -398,7 +398,7 @@ ghc::filesystem::path generate_group_endpoint( return get_temporary_directory() / socket_name.str(); } -Configuration load_config_for(const fs::path& yabridge_path, Logger& logger) { +Configuration load_config_for(const fs::path& yabridge_path) { // First find the closest `yabridge.tmol` file for the plugin, falling back // to default configuration settings if it doesn't exist const std::optional config_file = @@ -410,6 +410,8 @@ Configuration load_config_for(const fs::path& yabridge_path, Logger& logger) { try { return Configuration(*config_file, yabridge_path); } catch (const toml::parse_error& error) { + Logger logger = Logger::create_exception_logger(); + // Parsing failures should be non-fatal since that leads to a pretty // confusing user experience (see // https://github.com/robbert-vdh/yabridge/issues/282). They should, diff --git a/src/plugin/utils.h b/src/plugin/utils.h index 6bb09c55..f198bae6 100644 --- a/src/plugin/utils.h +++ b/src/plugin/utils.h @@ -248,8 +248,6 @@ ghc::filesystem::path generate_group_endpoint( * @param yabridge_path The path to the .so file that's being loaded.by the VST * host. This will be used both for the starting location of the search and to * determine which section in the config file to use. - * @param logger The logger used to log parsing errors to. Parsing errors are - * non-fatal, but they should still be very visible. * * @return Either a configuration object populated with values from matched glob * pattern within the found configuration file, or an empty configuration @@ -258,8 +256,7 @@ ghc::filesystem::path generate_group_endpoint( * * @see Configuration */ -Configuration load_config_for(const ghc::filesystem::path& yabridge_path, - Logger& logger); +Configuration load_config_for(const ghc::filesystem::path& yabridge_path); /** * Starting from the starting file or directory, go up in the directory