From aa1a7a1588bc13cdfb971974dcb00e25d41eb186 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 17 Jan 2021 00:19:48 +0100 Subject: [PATCH] Fully implement IProgress `IParameterFunctionName` will be the last interface before we _in theory_ support all VST3 features. --- src/common/serialization/vst3.h | 3 ++ .../bridges/vst3-impls/plugin-proxy.cpp | 1 + src/plugin/bridges/vst3-impls/plugin-proxy.h | 1 + src/plugin/bridges/vst3.cpp | 29 +++++++++++++++++++ .../vst3-impls/component-handler-proxy.cpp | 27 +++++++++++------ 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index 5c9b83a6..79421209 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -208,6 +208,9 @@ using CallbackRequest = YaHostApplication::GetName, YaPlugFrame::ResizeView, YaPlugInterfaceSupport::IsPlugInterfaceSupported, + YaProgress::Start, + YaProgress::Update, + YaProgress::Finish, YaUnitHandler::NotifyUnitSelection, YaUnitHandler::NotifyProgramListChange, YaUnitHandler2::NotifyUnitByBusChange>; diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index 32040c40..eedb6eee 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; component_handler_bus_activation = component_handler; + progress = component_handler; unit_handler = component_handler; unit_handler_2 = component_handler; diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.h b/src/plugin/bridges/vst3-impls/plugin-proxy.h index 520e5b21..a968521e 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.h +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.h @@ -353,6 +353,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy { component_handler_3; Steinberg::FUnknownPtr component_handler_bus_activation; + Steinberg::FUnknownPtr progress; Steinberg::FUnknownPtr unit_handler; Steinberg::FUnknownPtr unit_handler_2; diff --git a/src/plugin/bridges/vst3.cpp b/src/plugin/bridges/vst3.cpp index c4af0a0b..0712c5c9 100644 --- a/src/plugin/bridges/vst3.cpp +++ b/src/plugin/bridges/vst3.cpp @@ -287,6 +287,35 @@ Vst3PluginBridge::Vst3PluginBridge() request.iid.data()); } }, + [&](const YaProgress::Start& request) + -> YaProgress::Start::Response { + Steinberg::Vst::IProgress::ID out_id; + const tresult result = + plugin_proxies.at(request.owner_instance_id) + .get() + .progress->start( + request.type, + request.optional_description + ? u16string_to_tchar_pointer( + *request.optional_description) + : nullptr, + out_id); + + return YaProgress::StartResponse{.result = result, + .out_id = out_id}; + }, + [&](const YaProgress::Update& request) + -> YaProgress::Update::Response { + return plugin_proxies.at(request.owner_instance_id) + .get() + .progress->update(request.id, request.norm_value); + }, + [&](const YaProgress::Finish& request) + -> YaProgress::Finish::Response { + return plugin_proxies.at(request.owner_instance_id) + .get() + .progress->finish(request.id); + }, [&](const YaUnitHandler::NotifyUnitSelection& request) -> YaUnitHandler::NotifyUnitSelection::Response { return plugin_proxies.at(request.owner_instance_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 1ddb0749..f024ca74 100644 --- a/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/component-handler-proxy.cpp @@ -132,23 +132,32 @@ tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::start( ProgressType type, const Steinberg::tchar* optionalDescription, ID& outID) { - // TODO: Implement - std::cerr << "TODO: Implement IProgress::start()" << std::endl; - return Steinberg::kNotImplemented; + const StartResponse response = bridge.send_message(YaProgress::Start{ + .owner_instance_id = owner_instance_id(), + .type = type, + .optional_description = + (optionalDescription + ? std::optional( + tchar_pointer_to_u16string(optionalDescription)) + : std::nullopt)}); + + outID = response.out_id; + + return response.result; } tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::update(ID id, Steinberg::Vst::ParamValue normValue) { - // TODO: Implement - std::cerr << "TODO: Implement IProgress::update()" << std::endl; - return Steinberg::kNotImplemented; + return bridge.send_message( + YaProgress::Update{.owner_instance_id = owner_instance_id(), + .id = id, + .norm_value = normValue}); } tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::finish(ID id) { - // TODO: Implement - std::cerr << "TODO: Implement IProgress::finish()" << std::endl; - return Steinberg::kNotImplemented; + return bridge.send_message( + YaProgress::Finish{.owner_instance_id = owner_instance_id(), .id = id}); } tresult PLUGIN_API Vst3ComponentHandlerProxyImpl::notifyUnitSelection(