diff --git a/README.md b/README.md index e422afc6..82e9a8a1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ incomplete list of things that still have to be done before this can be used: - Interfaces left to implement: - `IHostApplication::createComponent()` - - The other parts of `IConnectionPoint`, including support for host provided proxies + - `IConnectionPoint::notify()`, and support for indirectly connecting + components through message passing proxies - Finish implementing `IEditController{,2}` - All other mandatory interfaces - All other optional interfaces diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 82e98863..50321f3f 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -283,6 +283,15 @@ void Vst3Logger::log_request(bool is_host_vst, }); } +void Vst3Logger::log_request(bool is_host_vst, + const YaConnectionPoint::Disconnect& request) { + log_request_base(is_host_vst, [&](auto& message) { + message << request.instance_id + << ": IConnectionPoint::disconnect(other = )"; + }); +} + void Vst3Logger::log_request( bool is_host_vst, const YaEditController2::SetComponentState& request) { diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index c321d61a..b4e07bad 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -80,6 +80,7 @@ class Vst3Logger { void log_request(bool is_host_vst, const YaComponent::ActivateBus&); void log_request(bool is_host_vst, const YaComponent::SetActive&); void log_request(bool is_host_vst, const YaConnectionPoint::Connect&); + void log_request(bool is_host_vst, const YaConnectionPoint::Disconnect&); void log_request(bool is_host_vst, const YaEditController2::SetComponentState&); void log_request(bool is_host_vst, diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index ee85fd7b..1f2d6ba9 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -76,6 +76,7 @@ using ControlRequest = std::variant + void serialize(S& s) { + s.value8b(instance_id); + s.value8b(other_instance_id); + } + }; + virtual tresult PLUGIN_API disconnect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API notify(Steinberg::Vst::IMessage* message) override = 0; diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index 50f99432..d9dc4a2d 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -207,9 +207,19 @@ tresult PLUGIN_API Vst3PluginProxyImpl::connect(IConnectionPoint* other) { } tresult PLUGIN_API Vst3PluginProxyImpl::disconnect(IConnectionPoint* other) { - // TODO: Implement - bridge.logger.log("TODO IConnectionPoint::disconnect()"); - return Steinberg::kNotImplemented; + // See `Vst3PluginProxyImpl::connect()` + if (auto other_proxy = dynamic_cast(other)) { + return bridge.send_message(YaConnectionPoint::Disconnect{ + .instance_id = instance_id(), + .other_instance_id = other_proxy->instance_id()}); + } else { + // TODO: Add support for `ConnectionProxy` and similar objects + bridge.logger.log( + "WARNING: The host passed a proxy proxy object to " + "'IConnectionPoint::disconnect()'. This is currently not " + "supported."); + return Steinberg::kNotImplemented; + } } tresult PLUGIN_API diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index fa45e490..f7f16e46 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -261,6 +261,15 @@ void Vst3Bridge::run() { object_instances[request.other_instance_id] .connection_point); }, + [&](const YaConnectionPoint::Disconnect& request) + -> YaConnectionPoint::Disconnect::Response { + // TODO: Add support for connecting objects through a proxy + // object provided by the host + return object_instances[request.instance_id] + .connection_point->disconnect( + object_instances[request.other_instance_id] + .connection_point); + }, [&](YaEditController2::SetComponentState& request) -> YaEditController2::SetComponentState::Response { return object_instances[request.instance_id]