diff --git a/src/wine-host/bridges/common.cpp b/src/wine-host/bridges/common.cpp index e585ac96..a80d6193 100644 --- a/src/wine-host/bridges/common.cpp +++ b/src/wine-host/bridges/common.cpp @@ -18,8 +18,11 @@ #include "../editor.h" -HostBridge::HostBridge(boost::filesystem::path plugin_path) - : plugin_path(plugin_path), generic_logger(Logger::create_wine_stderr()) {} +HostBridge::HostBridge(MainContext& main_context, + boost::filesystem::path plugin_path) + : plugin_path(plugin_path), + main_context(main_context), + generic_logger(Logger::create_wine_stderr()) {} void HostBridge::handle_win32_events() { MSG msg; diff --git a/src/wine-host/bridges/common.h b/src/wine-host/bridges/common.h index f2912863..76b1a5e8 100644 --- a/src/wine-host/bridges/common.h +++ b/src/wine-host/bridges/common.h @@ -21,6 +21,7 @@ #include #include "../../common/logging/common.h" +#include "../utils.h" /** * The base for the Wine plugin host bridge interface for all plugin types. This @@ -29,7 +30,7 @@ */ class HostBridge { protected: - HostBridge(boost::filesystem::path plugin_path); + HostBridge(MainContext& main_context, boost::filesystem::path plugin_path); public: virtual ~HostBridge(){}; @@ -91,6 +92,13 @@ class HostBridge { const boost::filesystem::path plugin_path; protected: + /** + * The IO context used for event handling so that all events and window + * message handling can be performed from a single thread, even when hosting + * multiple plugins. + */ + MainContext& main_context; + /** * A logger, just like we have on the plugin side. This is normally not * needed because we can just print to STDERR, but this way we can diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index a9bb547e..3f5c772b 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -69,9 +69,8 @@ Vst2Bridge& get_bridge_instance(const AEffect* plugin) { Vst2Bridge::Vst2Bridge(MainContext& main_context, std::string plugin_dll_path, std::string endpoint_base_dir) - : HostBridge(plugin_dll_path), + : HostBridge(main_context, 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) { // HACK: If the plugin library was unable to load, then there's a tiny diff --git a/src/wine-host/bridges/vst2.h b/src/wine-host/bridges/vst2.h index c317eb4f..399c6595 100644 --- a/src/wine-host/bridges/vst2.h +++ b/src/wine-host/bridges/vst2.h @@ -28,7 +28,6 @@ #include "../../common/communication/vst2.h" #include "../../common/configuration.h" #include "../editor.h" -#include "../utils.h" #include "common.h" /** @@ -96,13 +95,6 @@ class Vst2Bridge : public HostBridge { */ Vst2Logger logger; - /** - * The IO context used for event handling so that all events and window - * message handling can be performed from a single thread, even when hosting - * multiple plugins. - */ - MainContext& main_context; - /** * The configuration for this instance of yabridge based on the `.so` file * that got loaded by the host. This configuration gets loaded on the plugin diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index b6ec5119..b6e83e53 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -90,9 +90,8 @@ InstanceInterfaces::InstanceInterfaces( Vst3Bridge::Vst3Bridge(MainContext& main_context, std::string plugin_dll_path, std::string endpoint_base_dir) - : HostBridge(plugin_dll_path), + : HostBridge(main_context, plugin_dll_path), logger(generic_logger), - main_context(main_context), sockets(main_context.context, endpoint_base_dir, false) { std::string error; module = VST3::Hosting::Win32Module::create(plugin_dll_path, error); diff --git a/src/wine-host/bridges/vst3.h b/src/wine-host/bridges/vst3.h index 60a04cb6..3a610df5 100644 --- a/src/wine-host/bridges/vst3.h +++ b/src/wine-host/bridges/vst3.h @@ -420,13 +420,6 @@ class Vst3Bridge : public HostBridge { */ void unregister_object_instance(size_t instance_id); - /** - * The IO context used for event handling so that all events and window - * message handling can be performed from a single thread, even when hosting - * multiple plugins. - */ - MainContext& main_context; - /** * The configuration for this instance of yabridge based on the `.so` file * that got loaded by the host. This configuration gets loaded on the plugin