diff --git a/README.md b/README.md index cb80e01b..96507bd6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ incomplete list of things that still have to be done before this can be used: - Interfaces left to implement: - `YaHostApplicationHostImpl::createComponent()` - - `IConnectionPoint` to supplement `IComponent` + - The other parts of `IConnectionPoint`, including support for host provided 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 9b3f6dce..2d7a0d7e 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -270,6 +270,15 @@ void Vst3Logger::log_request(bool is_host_vst, }); } +void Vst3Logger::log_request(bool is_host_vst, + const YaConnectionPoint::Connect& request) { + log_request_base(is_host_vst, [&](auto& message) { + message << request.instance_id + << ": IConnectionPoint::connect(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 36b0cb65..c259da72 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -79,6 +79,7 @@ class Vst3Logger { void log_request(bool is_host_vst, const YaComponent::GetRoutingInfo&); 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 YaEditController2::SetComponentState&); void log_request(bool is_host_vst, diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index 83835b92..d634d647 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -75,6 +75,7 @@ using ControlRequest = std::variant + void serialize(S& s) { + s.value8b(instance_id); + s.value8b(other_instance_id); + } + }; + virtual tresult PLUGIN_API connect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API disconnect(IConnectionPoint* other) override = 0; virtual tresult PLUGIN_API diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index 4e68416a..4fa96ff5 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -193,13 +193,9 @@ tresult PLUGIN_API Vst3PluginProxyImpl::connect(IConnectionPoint* other) { // 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; + return bridge.send_message(YaConnectionPoint::Connect{ + .instance_id = arguments.instance_id, + .other_instance_id = other_proxy->instance_id()}); } else { // TODO: Add support for `ConnectionProxy` and similar objects bridge.logger.log( diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index c5decbce..2163e59d 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -32,6 +32,7 @@ InstanceInterfaces::InstanceInterfaces( : object(object), audio_processor(object), component(object), + connection_point(object), edit_controller(object), plugin_base(object) {} @@ -250,6 +251,16 @@ void Vst3Bridge::run() { return object_instances[request.instance_id] .component->setActive(request.state); }, + [&](const YaConnectionPoint::Connect& request) + -> YaConnectionPoint::Connect::Response { + // We can directly connect the underlying objects + // TODO: Add support for connecting objects through a proxy + // object provided by the host + return object_instances[request.instance_id] + .connection_point->connect( + object_instances[request.other_instance_id] + .connection_point); + }, [&](YaEditController2::SetComponentState& request) -> YaEditController2::SetComponentState::Response { return object_instances[request.instance_id] diff --git a/src/wine-host/bridges/vst3.h b/src/wine-host/bridges/vst3.h index b31ef7da..0253d6b3 100644 --- a/src/wine-host/bridges/vst3.h +++ b/src/wine-host/bridges/vst3.h @@ -54,6 +54,7 @@ struct InstanceInterfaces { Steinberg::FUnknownPtr audio_processor; Steinberg::FUnknownPtr component; + Steinberg::FUnknownPtr connection_point; Steinberg::FUnknownPtr edit_controller; Steinberg::FUnknownPtr plugin_base; };