Print the configuration on startup

This commit is contained in:
Robbert van der Helm
2020-05-16 16:18:16 +02:00
parent 312200f100
commit d2cd608abb
4 changed files with 64 additions and 14 deletions
+1
View File
@@ -67,5 +67,6 @@ Configuration Configuration::load_for(const fs::path& yabridge_path) {
return Configuration(); return Configuration();
} }
// TODO: Disable plugin groups when not compiling with plugin group support
return Configuration(config_file.value(), yabridge_path); return Configuration(config_file.value(), yabridge_path);
} }
+4
View File
@@ -46,6 +46,7 @@
* Otherwise the default settings will be used. * Otherwise the default settings will be used.
*/ */
class Configuration { class Configuration {
public:
/** /**
* Create an empty configuration object with default settings. * Create an empty configuration object with default settings.
*/ */
@@ -69,6 +70,9 @@ class Configuration {
* `libyabridge.so`. If no configuration file could be found then this will * `libyabridge.so`. If no configuration file could be found then this will
* return an empty configuration object with default settings. * return an empty configuration object with default settings.
* *
* This function will take any optional compile-time features that have not
* been enabled into account.
*
* @param yabridge_path The path to the .so file that's being loaded.by the * @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 * 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. * search and to determine which section in the config file to use.
+44 -14
View File
@@ -71,6 +71,7 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
host_callback_function(host_callback), host_callback_function(host_callback),
logger(Logger::create_from_environment( logger(Logger::create_from_environment(
create_logger_prefix(socket_endpoint.path()))), create_logger_prefix(socket_endpoint.path()))),
config(Configuration::load_for(get_this_file_location())),
wine_version(get_wine_version()), wine_version(get_wine_version()),
wine_stdout(io_context), wine_stdout(io_context),
wine_stderr(io_context), wine_stderr(io_context),
@@ -102,29 +103,58 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
bp::start_dir = vst_plugin_path.parent_path()) bp::start_dir = vst_plugin_path.parent_path())
#endif #endif
{ {
logger.log("Initializing yabridge version " + std::stringstream init_msg;
std::string(yabridge_git_version)); init_msg << "Initializing yabridge version " << yabridge_git_version
logger.log("host: '" + vst_host_path.string() + "'"); << std::endl;
logger.log("plugin: '" + vst_plugin_path.string() + "'"); init_msg << "host: '" << vst_host_path.string() << "'" << std::endl;
logger.log("socket: '" + socket_endpoint.path() + "'"); init_msg << "plugin: '" << vst_plugin_path.string() << "'"
logger.log("wine prefix: '" + << std::endl;
find_wineprefix().value_or("<default>").string() + "'"); init_msg << "socket: '" << socket_endpoint.path() << "'" << std::endl;
logger.log("wine version: '" + wine_version + "'"); init_msg << "wine prefix: '"
<< find_wineprefix().value_or("<default>").string() << "'"
<< std::endl;
init_msg << "wine version: '" << wine_version << "'" << std::endl;
init_msg << std::endl;
// Print the path to the currently loaded configuration file and all
// settings in use. Printing the matched glob pattern could also be useful
// but it'll be very noisy and it's likely going to be clear from the shown
// values anyways.
init_msg << "config path: '"
<< config.matched_file.value_or("<default>").string() << "'"
<< std::endl;
init_msg << "hosting mode: '";
if (config.group.has_value()) {
init_msg << "group \"" << config.group.value() << "\"";
} else {
init_msg << "individual";
}
if (vst_plugin_arch == PluginArchitecture::vst_32) {
init_msg << ", 32-bit";
} else {
init_msg << ", 64-bit";
}
init_msg << "'" << std::endl;
init_msg << std::endl;
// Include a list of enabled compile-tiem features, mostly to make debug // Include a list of enabled compile-tiem features, mostly to make debug
// logs more useful // logs more useful
logger.log(""); // TODO: Add a feature flag for the plugin group support
logger.log("Enabled features:"); init_msg << "Enabled features:" << std::endl;
#ifdef USE_BITBRIDGE #ifdef USE_BITBRIDGE
logger.log("- bitbridge support"); init_msg << "- bitbridge support" << std::endl;
#endif #endif
#ifdef USE_WINEDBG #ifdef USE_WINEDBG
logger.log("- winedbg"); init_msg << "- winedbg" << std::endl;
#endif #endif
#if !(defined(USE_BITBRIDGE) || defined(USE_WINEDBG)) #if !(defined(USE_BITBRIDGE) || defined(USE_WINEDBG))
logger.log(" <none>"); init_msg << " <none>" << std::endl;
#endif #endif
logger.log(""); init_msg << std::endl;
for (std::string line = ""; std::getline(init_msg, line);) {
logger.log(line);
}
// Print the Wine host's STDOUT and STDERR streams to the log file. This // Print the Wine host's STDOUT and STDERR streams to the log file. This
// should be done before trying to accept the sockets as otherwise we will // should be done before trying to accept the sockets as otherwise we will
+15
View File
@@ -26,6 +26,7 @@
#include <thread> #include <thread>
#include "../common/logging.h" #include "../common/logging.h"
#include "configuration.h"
#include "utils.h" #include "utils.h"
/** /**
@@ -171,8 +172,22 @@ class PluginBridge {
*/ */
audioMasterCallback host_callback_function; audioMasterCallback host_callback_function;
/**
* The logging facility used for this instance of yabridge. See
* `Logger::create_from_env()` for how this is configured.
*
* @see Logger::create_from_env
*/
Logger logger; 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 * The version of Wine currently in use. Used in the debug output on plugin
* startup. * startup.