mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Implement IEditController::getParamValueByString()
This commit is contained in:
@@ -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 << ", <ParameterInfo for '" << title << "'>";
|
||||
message << ", <ParameterInfo for '" << param_title << "'>";
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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&);
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
|
||||
YaEditController2::GetParameterCount,
|
||||
YaEditController2::GetParameterInfo,
|
||||
YaEditController2::GetParamStringByValue,
|
||||
YaEditController2::GetParamValueByString,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
|
||||
@@ -207,6 +207,45 @@ class YaEditController2 : public Steinberg::Vst::IEditController,
|
||||
Steinberg::Vst::ParamID id,
|
||||
Steinberg::Vst::ParamValue valueNormalized /*in*/,
|
||||
Steinberg::Vst::String128 string /*out*/) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and returned parameter information for a call to
|
||||
* `IEditController::getParamValueByString(id, string,
|
||||
* &&value_normalized)`.
|
||||
*/
|
||||
struct GetParamValueByStringResponse {
|
||||
UniversalTResult result;
|
||||
|
||||
Steinberg::Vst::ParamValue value_normalized;
|
||||
|
||||
template <typename S>
|
||||
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 <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value4b(id);
|
||||
s.container2b(string, std::extent_v<Steinberg::Vst::String128>);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API getParamValueByString(
|
||||
Steinberg::Vst::ParamID id,
|
||||
Steinberg::Vst::TChar* string /*in*/,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Steinberg::Vst::TChar*>(
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user