diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 9f0e7cff..8cd75273 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -471,6 +471,16 @@ bool Vst3Logger::log_request(bool is_host_vst, }); } +bool Vst3Logger::log_request( + bool is_host_vst, + const YaComponentHandler::RestartComponent& request) { + return log_request_base(is_host_vst, [&](auto& message) { + message << request.owner_instance_id + << ": IComponentHandler::restartComponent(flags = " + << request.flags << ")"; + }); +} + 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 3132d8f7..42639df4 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -113,6 +113,8 @@ class Vst3Logger { 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&); + bool log_request(bool is_host_vst, + const YaComponentHandler::RestartComponent&); 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 0d0049cc..295902b3 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -108,7 +108,8 @@ void serialize(S& s, ControlRequest& payload) { using CallbackRequest = std::variant; + YaComponentHandler::EndEdit, + YaComponentHandler::RestartComponent>; 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 90e5f217..a55f8144 100644 --- a/src/common/serialization/vst3/component-handler/component-handler.h +++ b/src/common/serialization/vst3/component-handler/component-handler.h @@ -125,6 +125,26 @@ class YaComponentHandler : public Steinberg::Vst::IComponentHandler { }; virtual tresult PLUGIN_API endEdit(Steinberg::Vst::ParamID id) override = 0; + + /** + * Message to pass through a call to + * `IComponentHandler::restartComponent(flags)` to the component handler + * provided by the host. + */ + struct RestartComponent { + using Response = UniversalTResult; + + native_size_t owner_instance_id; + + int32 flags; + + template + void serialize(S& s) { + s.value8b(owner_instance_id); + s.value4b(flags); + } + }; + virtual tresult PLUGIN_API restartComponent(int32 flags) override = 0; protected: diff --git a/src/plugin/bridges/vst3.cpp b/src/plugin/bridges/vst3.cpp index c352b112..35811bfc 100644 --- a/src/plugin/bridges/vst3.cpp +++ b/src/plugin/bridges/vst3.cpp @@ -102,6 +102,12 @@ Vst3PluginBridge::Vst3PluginBridge() .get() .component_handler->endEdit(request.id); }, + [&](const YaComponentHandler::RestartComponent& request) + -> YaComponentHandler::EndEdit::Response { + return plugin_proxies.at(request.owner_instance_id) + .get() + .component_handler->restartComponent(request.flags); + }, }); }); } 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 730ed3c8..615a909f 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp @@ -62,7 +62,6 @@ Vst3ComponentHandlerProxyImpl::endEdit(Steinberg::Vst::ParamID id) { tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::restartComponent(int32 flags) { - // TODO: Implement - std::cerr << "TODO: IComponentHandler::restartComponent()" << std::endl; - return Steinberg::kNotImplemented; + return bridge.send_message(YaComponentHandler::RestartComponent{ + .owner_instance_id = owner_instance_id(), .flags = flags}); }