diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 2d7a0d7e..b7bb7d46 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -321,6 +321,18 @@ void Vst3Logger::log_request( }); } +void Vst3Logger::log_request( + bool is_host_vst, + const YaEditController2::GetParamValueByString& request) { + log_request_base(is_host_vst, [&](auto& message) { + std::string param_title = VST3::StringConvert::convert(request.string); + message << request.instance_id + << ": IEditController::getParamValueByString(id = " + << request.id << ", string = " << param_title + << ", &valueNormalized)"; + }); +} + void Vst3Logger::log_request(bool is_host_vst, const YaPluginBase::Initialize& request) { log_request_base(is_host_vst, [&](auto& message) { @@ -478,9 +490,9 @@ void Vst3Logger::log_response( log_response_base(is_host_vst, [&](auto& message) { message << response.result.string(); if (response.result == Steinberg::kResultOk) { - std::string title = + std::string param_title = VST3::StringConvert::convert(response.updated_info.title); - message << ", "; + message << ", "; } }); } @@ -491,8 +503,19 @@ void Vst3Logger::log_response( log_response_base(is_host_vst, [&](auto& message) { message << response.result.string(); if (response.result == Steinberg::kResultOk) { - std::string title = VST3::StringConvert::convert(response.string); - message << ", \"" << title << "\""; + std::string value = VST3::StringConvert::convert(response.string); + message << ", \"" << value << "\""; + } + }); +} + +void Vst3Logger::log_response( + bool is_host_vst, + const YaEditController2::GetParamValueByStringResponse& response) { + log_response_base(is_host_vst, [&](auto& message) { + message << response.result.string(); + if (response.result == Steinberg::kResultOk) { + message << ", " << response.value_normalized << std::endl; } }); } diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index c259da72..37d82312 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -88,6 +88,8 @@ class Vst3Logger { const YaEditController2::GetParameterInfo&); void log_request(bool is_host_vst, const YaEditController2::GetParamStringByValue&); + void log_request(bool is_host_vst, + const YaEditController2::GetParamValueByString&); void log_request(bool is_host_vst, const YaPluginBase::Initialize&); void log_request(bool is_host_vst, const YaPluginBase::Terminate&); void log_request(bool is_host_vst, const YaPluginFactory::Construct&); @@ -111,6 +113,8 @@ class Vst3Logger { const YaEditController2::GetParameterInfoResponse&); void log_response(bool is_host_vst, const YaEditController2::GetParamStringByValueResponse&); + void log_response(bool is_host_vst, + const YaEditController2::GetParamValueByStringResponse&); void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&); void log_response(bool is_host_vst, const Configuration&); diff --git a/src/common/serialization/vst3.h b/src/common/serialization/vst3.h index d634d647..5960daab 100644 --- a/src/common/serialization/vst3.h +++ b/src/common/serialization/vst3.h @@ -80,6 +80,7 @@ using ControlRequest = std::variant + void serialize(S& s) { + s.object(result); + s.value8b(value_normalized); + } + }; + + /** + * Message to pass through a call to + * `IEditController::getParamValueByString(id, string, &value_normalized)` + * to the Wine plugin host. + */ + struct GetParamValueByString { + using Response = GetParamValueByStringResponse; + + native_size_t instance_id; + + Steinberg::Vst::ParamID id; + std::u16string string; + + template + void serialize(S& s) { + s.value8b(instance_id); + s.value4b(id); + s.container2b(string, std::extent_v); + } + }; + virtual tresult PLUGIN_API getParamValueByString( Steinberg::Vst::ParamID id, Steinberg::Vst::TChar* string /*in*/, diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index 2acaa1ff..609d505c 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -263,9 +263,13 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getParamValueByString( Steinberg::Vst::ParamID id, Steinberg::Vst::TChar* string /*in*/, Steinberg::Vst::ParamValue& valueNormalized /*out*/) { - // TODO: Implement - bridge.logger.log("TODO IEditController::getParamValueByString()"); - return Steinberg::kNotImplemented; + const GetParamValueByStringResponse response = + bridge.send_message(YaEditController2::GetParamValueByString{ + .instance_id = instance_id(), .id = id, .string = string}); + + valueNormalized = response.value_normalized; + + return response.result; } Steinberg::Vst::ParamValue PLUGIN_API diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index b1255d22..46a878a7 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -293,6 +293,21 @@ void Vst3Bridge::run() { .result = result, .string = tchar_pointer_to_u16string(string)}; }, + [&](YaEditController2::GetParamValueByString& request) + -> YaEditController2::GetParamValueByString::Response { + Steinberg::Vst::ParamValue value_normalized; + const tresult result = + object_instances[request.instance_id] + .edit_controller->getParamValueByString( + request.id, + const_cast( + u16string_to_tchar_pointer( + request.string.c_str())), + value_normalized); + + return YaEditController2::GetParamValueByStringResponse{ + .result = result, .value_normalized = value_normalized}; + }, [&](YaPluginBase::Initialize& request) -> YaPluginBase::Initialize::Response { // If we got passed a host context, we'll create a proxy object