From 25575e2d3a18680c502592d8bd2c64fa95223dbe Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 19 Dec 2020 15:48:06 +0100 Subject: [PATCH] Implement IComponentHandler::endEdit() --- src/common/logging/vst3.cpp | 8 ++++++++ src/common/logging/vst3.h | 1 + src/common/serialization/vst3.h | 3 ++- .../component-handler/component-handler.h | 19 +++++++++++++++++++ src/plugin/bridges/vst3.cpp | 6 ++++++ .../vst3-impls/component-handler-proxy.cpp | 5 ++--- 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 3f970d2a..9f0e7cff 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -463,6 +463,14 @@ bool Vst3Logger::log_request(bool is_host_vst, }); } +bool Vst3Logger::log_request(bool is_host_vst, + const YaComponentHandler::EndEdit& request) { + return log_request_base(is_host_vst, [&](auto& message) { + message << request.owner_instance_id + << ": IComponentHandler::endEdit(id = " << request.id << ")"; + }); +} + void Vst3Logger::log_response(bool is_host_vst, const Ack&) { log_response_base(is_host_vst, [&](auto& message) { message << "ACK"; }); } diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 71fbbef6..3132d8f7 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -112,6 +112,7 @@ class Vst3Logger { bool log_request(bool is_host_vst, const WantsConfiguration&); bool log_request(bool is_host_vst, const YaComponentHandler::BeginEdit&); bool log_request(bool is_host_vst, const YaComponentHandler::PerformEdit&); + bool log_request(bool is_host_vst, const YaComponentHandler::EndEdit&); void log_response(bool is_host_vst, const Ack&); void log_response( diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index c6ab00fb..0d0049cc 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -107,7 +107,8 @@ void serialize(S& s, ControlRequest& payload) { */ using CallbackRequest = std::variant; + YaComponentHandler::PerformEdit, + YaComponentHandler::EndEdit>; template void serialize(S& s, CallbackRequest& payload) { diff --git a/src/common/serialization/vst3/component-handler/component-handler.h b/src/common/serialization/vst3/component-handler/component-handler.h index a17d05a2..90e5f217 100644 --- a/src/common/serialization/vst3/component-handler/component-handler.h +++ b/src/common/serialization/vst3/component-handler/component-handler.h @@ -105,6 +105,25 @@ class YaComponentHandler : public Steinberg::Vst::IComponentHandler { virtual tresult PLUGIN_API performEdit(Steinberg::Vst::ParamID id, Steinberg::Vst::ParamValue valueNormalized) override = 0; + + /** + * Message to pass through a call to `IComponentHandler::endEdit(id)` to the + * component handler provided by the host. + */ + struct EndEdit { + using Response = UniversalTResult; + + native_size_t owner_instance_id; + + Steinberg::Vst::ParamID id; + + template + void serialize(S& s) { + s.value8b(owner_instance_id); + s.value4b(id); + } + }; + virtual tresult PLUGIN_API endEdit(Steinberg::Vst::ParamID id) override = 0; virtual tresult PLUGIN_API restartComponent(int32 flags) override = 0; diff --git a/src/plugin/bridges/vst3.cpp b/src/plugin/bridges/vst3.cpp index 741ba9e8..c352b112 100644 --- a/src/plugin/bridges/vst3.cpp +++ b/src/plugin/bridges/vst3.cpp @@ -96,6 +96,12 @@ Vst3PluginBridge::Vst3PluginBridge() .component_handler->performEdit( request.id, request.value_normalized); }, + [&](const YaComponentHandler::EndEdit& request) + -> YaComponentHandler::EndEdit::Response { + return plugin_proxies.at(request.owner_instance_id) + .get() + .component_handler->endEdit(request.id); + }, }); }); } 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 388eaa31..730ed3c8 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp @@ -56,9 +56,8 @@ tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::performEdit( tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::endEdit(Steinberg::Vst::ParamID id) { - // TODO: Implement - std::cerr << "TODO: IComponentHandler::endEdit()" << std::endl; - return Steinberg::kNotImplemented; + return bridge.send_message(YaComponentHandler::EndEdit{ + .owner_instance_id = owner_instance_id(), .id = id}); } tresult PLUGIN_API