From 41a9ca5a361f12e0b0d84efc6fad5fa49e0dddee Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 18 Dec 2020 13:44:55 +0100 Subject: [PATCH] Add boilerplate for connecting Vst3PluginProxies This way we can identify the actual objects and directly connect them on the Wine side. --- src/common/serialization/vst3/plugin-proxy.h | 6 ++++++ .../bridges/vst3-impls/plugin-proxy.cpp | 21 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/common/serialization/vst3/plugin-proxy.h b/src/common/serialization/vst3/plugin-proxy.h index dc7a67ca..48cd5ccd 100644 --- a/src/common/serialization/vst3/plugin-proxy.h +++ b/src/common/serialization/vst3/plugin-proxy.h @@ -154,6 +154,12 @@ class Vst3PluginProxy : public YaAudioProcessor, DECLARE_FUNKNOWN_METHODS + /** + * Get this object's instance ID. Used in `IConnectionPoint` to identify and + * connect specific objects. + */ + inline size_t instance_id() const { return arguments.instance_id; } + // We'll define messages for functions that have identical definitions in // multiple interfaces below. When the Wine plugin host process handles // these it should check which of the interfaces is supported on the host. diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index e809b94f..4e68416a 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -189,9 +189,24 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getState(Steinberg::IBStream* state) { } tresult PLUGIN_API Vst3PluginProxyImpl::connect(IConnectionPoint* other) { - // TODO: Implement - bridge.logger.log("TODO IConnectionPoint::connect()"); - return Steinberg::kNotImplemented; + // When the host is trying to connect two plugin proxy objects, we can just + // identify the other object by its instance IDs and then connect the + // objects in the Wine plugin host directly + if (auto other_proxy = dynamic_cast(other)) { + // TODO: Remove debug + bridge.logger.log("Host is trying to connect us with instance " + + std::to_string(other_proxy->instance_id())); + + // TODO: Implement + bridge.logger.log("TODO IConnectionPoint::connect()"); + return Steinberg::kNotImplemented; + } else { + // TODO: Add support for `ConnectionProxy` and similar objects + bridge.logger.log( + "WARNING: The host passed a proxy proxy object to " + "'IConnectionPoint::connect()'. This is currently not supported."); + return Steinberg::kNotImplemented; + } } tresult PLUGIN_API Vst3PluginProxyImpl::disconnect(IConnectionPoint* other) {