From 70adf5493e52b466922ac4130c07a662089e77f3 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 28 Apr 2021 23:23:24 +0200 Subject: [PATCH] Add a logger to the Wine VST2 bridge --- src/wine-host/bridges/vst2.cpp | 1 + src/wine-host/bridges/vst2.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index 8c0c136c..19f2420b 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -70,6 +70,7 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context, std::string plugin_dll_path, std::string endpoint_base_dir) : HostBridge(plugin_dll_path), + logger(generic_logger), main_context(main_context), plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary), sockets(main_context.context, endpoint_base_dir, false) { diff --git a/src/wine-host/bridges/vst2.h b/src/wine-host/bridges/vst2.h index c9c1cf95..5f4a0491 100644 --- a/src/wine-host/bridges/vst2.h +++ b/src/wine-host/bridges/vst2.h @@ -75,6 +75,16 @@ class Vst2Bridge : public HostBridge { */ intptr_t host_callback(AEffect*, int, int, intptr_t, void*, float); + private: + /** + * A logger instance we'll use log cached `audioMasterGetTime()` calls, so + * they can be hidden on verbosity levels below 2. + * + * This only has to be used instead of directly writing to `std::cerr` when + * the message should be hidden on lower verbosity levels. + */ + Vst2Logger logger; + /** * With the `audioMasterGetTime` host callback the plugin expects the return * value from the calblack to be a pointer to a VstTimeInfo struct. If the @@ -83,7 +93,6 @@ class Vst2Bridge : public HostBridge { */ std::optional time_info; - private: /** * A wrapper around `plugin->dispatcher` that handles the opening and * closing of GUIs. Used inside of `handle_dispatch()`.