From 5855ffbe8568ac7b24c01bc5745e9225fcea7a68 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 10 Jan 2021 23:54:43 +0100 Subject: [PATCH] Fully implement IUnitHandler2 --- src/common/serialization/vst3.h | 3 ++- src/plugin/bridges/vst3-impls/plugin-proxy.cpp | 1 + src/plugin/bridges/vst3-impls/plugin-proxy.h | 1 + src/plugin/bridges/vst3.cpp | 6 ++++++ .../bridges/vst3-impls/component-handler-proxy.cpp | 5 ++--- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index 76e6503b..637af74f 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -200,7 +200,8 @@ using CallbackRequest = std::variant; + YaUnitHandler::NotifyProgramListChange, + YaUnitHandler2::NotifyUnitByBusChange>; template void serialize(S& s, CallbackRequest& payload) { diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index 2f068f49..f6707583 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -450,6 +450,7 @@ tresult PLUGIN_API Vst3PluginProxyImpl::setComponentHandler( component_handler_2 = component_handler; component_handler_3 = component_handler; unit_handler = component_handler; + unit_handler_2 = component_handler; return bridge.send_message(YaEditController::SetComponentHandler{ .instance_id = instance_id(), diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.h b/src/plugin/bridges/vst3-impls/plugin-proxy.h index 1ac819c5..a22d4db5 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.h +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.h @@ -327,6 +327,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy { Steinberg::FUnknownPtr component_handler_3; Steinberg::FUnknownPtr unit_handler; + Steinberg::FUnknownPtr unit_handler_2; private: Vst3PluginBridge& bridge; diff --git a/src/plugin/bridges/vst3.cpp b/src/plugin/bridges/vst3.cpp index 2e1b1728..92791ac4 100644 --- a/src/plugin/bridges/vst3.cpp +++ b/src/plugin/bridges/vst3.cpp @@ -267,6 +267,12 @@ Vst3PluginBridge::Vst3PluginBridge() .unit_handler->notifyProgramListChange( request.list_id, request.program_index); }, + [&](const YaUnitHandler2::NotifyUnitByBusChange& request) + -> YaUnitHandler2::NotifyUnitByBusChange::Response { + return plugin_proxies.at(request.owner_instance_id) + .get() + .unit_handler_2->notifyUnitByBusChange(); + }, }); }); } diff --git a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp index 2443a674..425677dc 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp @@ -130,7 +130,6 @@ tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyProgramListChange( } tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitByBusChange() { - // TODO: Implement - std::cerr << "TODO: IUnitHandler2::notifyUnitSelection()" << std::endl; - return Steinberg::kNotImplemented; + return bridge.send_message(YaUnitHandler2::NotifyUnitByBusChange{ + .owner_instance_id = owner_instance_id()}); }