diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 0a510633..30f76421 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -108,6 +108,21 @@ bool Vst3Logger::log_request(bool is_host_vst, }); } +bool Vst3Logger::log_request(bool is_host_vst, + const YaConnectionPoint::Notify& request) { + return log_request_base(is_host_vst, [&](auto& message) { + message << request.instance_id + << ": IConnectionPoint::notify(message = (request.message).getMessageID()) { + message << "with ID = \"" << id << "\""; + } else { + message << "without an ID"; + } + message << ">)"; + }); +} + bool Vst3Logger::log_request( bool is_host_vst, const YaEditController::SetComponentState& request) { diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index e317768c..65c52e31 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -66,6 +66,7 @@ class Vst3Logger { bool log_request(bool is_host_vst, const Vst3PluginProxy::GetState&); bool log_request(bool is_host_vst, const YaConnectionPoint::Connect&); bool log_request(bool is_host_vst, const YaConnectionPoint::Disconnect&); + bool log_request(bool is_host_vst, const YaConnectionPoint::Notify&); bool log_request(bool is_host_vst, const YaEditController::SetComponentState&); bool log_request(bool is_host_vst, diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index fe6fe52f..08853061 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -68,6 +68,7 @@ using ControlRequest = std::variant + void serialize(S& s) { + s.value8b(instance_id); + s.object(message); + } + }; + 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 66a5b826..0351b338 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -246,9 +246,22 @@ tresult PLUGIN_API Vst3PluginProxyImpl::disconnect(IConnectionPoint* other) { tresult PLUGIN_API Vst3PluginProxyImpl::notify(Steinberg::Vst::IMessage* message) { - // TODO: Implement - bridge.logger.log("TODO IConnectionPoint::notify()"); - return Steinberg::kNotImplemented; + // Since there is no way to enumerate over all values in an + // `IAttributeList`, we can only support relaying messages that were sent by + // our own objects. This is only needed to support hosts that place a + // connection proxy between two objects instead of connecting them directly. + // If the objects are connected directly we also connected them directly on + // the Wine side, so we don't have to do any additional when those objects + // pass through messages. + if (auto message_impl = dynamic_cast(message)) { + return bridge.send_message(YaConnectionPoint::Notify{ + .instance_id = instance_id(), .message = *message_impl}); + } else { + bridge.logger.log( + "WARNING: Unknown message type passed to " + "'IConnectionPoint::notify()', ignoring"); + return Steinberg::kNotImplemented; + } } tresult PLUGIN_API diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 756f948e..cc86beef 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -187,6 +187,11 @@ void Vst3Bridge::run() { object_instances[request.other_instance_id] .connection_point); }, + [&](YaConnectionPoint::Notify& request) + -> YaConnectionPoint::Notify::Response { + return object_instances[request.instance_id] + .connection_point->notify(&request.message); + }, [&](YaEditController::SetComponentState& request) -> YaEditController::SetComponentState::Response { return object_instances[request.instance_id]