mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 21:50:11 +02:00
Implement IEditController::getParameterInfo()
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "vst3.h"
|
||||
|
||||
#include <public.sdk/source/vst/utility/stringconvert.h>
|
||||
|
||||
#include "src/common/serialization/vst3.h"
|
||||
|
||||
Vst3Logger::Vst3Logger(Logger& generic_logger) : logger(generic_logger) {}
|
||||
@@ -283,6 +285,16 @@ void Vst3Logger::log_request(
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(
|
||||
bool is_host_vst,
|
||||
const YaEditController2::GetParameterInfo& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IEditController* #" << request.instance_id
|
||||
<< ">::getParameterInfo(paramIndex = " << request.param_index
|
||||
<< ", &info)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPluginBase::Initialize& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
@@ -434,6 +446,19 @@ void Vst3Logger::log_response(
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(
|
||||
bool is_host_vst,
|
||||
const YaEditController2::GetParameterInfoResponse& 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.updated_info.title);
|
||||
message << ", <ParameterInfo for '" << title << "'>";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaPluginFactory::ConstructArgs& args) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
@@ -83,6 +83,8 @@ class Vst3Logger {
|
||||
const YaEditController2::SetComponentState&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaEditController2::GetParameterCount&);
|
||||
void log_request(bool is_host_vst,
|
||||
const YaEditController2::GetParameterInfo&);
|
||||
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&);
|
||||
@@ -102,6 +104,8 @@ class Vst3Logger {
|
||||
void log_response(bool is_host_vst, const YaComponent::GetBusInfoResponse&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaComponent::GetRoutingInfoResponse&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaEditController2::GetParameterInfoResponse&);
|
||||
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
||||
void log_response(bool is_host_vst, const Configuration&);
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
|
||||
YaComponent::SetActive,
|
||||
YaEditController2::SetComponentState,
|
||||
YaEditController2::GetParameterCount,
|
||||
YaEditController2::GetParameterInfo,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
|
||||
@@ -124,6 +124,43 @@ class YaEditController2 : public Steinberg::Vst::IEditController,
|
||||
};
|
||||
|
||||
virtual int32 PLUGIN_API getParameterCount() override = 0;
|
||||
|
||||
/**
|
||||
* The response code and returned parameter information for a call to
|
||||
* `IEditController::getParameterINfo(param_index, &info)`.
|
||||
*/
|
||||
struct GetParameterInfoResponse {
|
||||
UniversalTResult result;
|
||||
Steinberg::Vst::ParameterInfo updated_info;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(updated_info);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
* `IEditController::getParameterINfo(param_index, &info)` to the Wine
|
||||
* plugin host.
|
||||
*/
|
||||
struct GetParameterInfo {
|
||||
using Response = GetParameterInfoResponse;
|
||||
|
||||
native_size_t instance_id;
|
||||
|
||||
int32 param_index;
|
||||
Steinberg::Vst::ParameterInfo info;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(instance_id);
|
||||
s.value4b(param_index);
|
||||
s.object(info);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
getParameterInfo(int32 paramIndex,
|
||||
Steinberg::Vst::ParameterInfo& info /*out*/) override = 0;
|
||||
@@ -163,3 +200,19 @@ class YaEditController2 : public Steinberg::Vst::IEditController,
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
template <typename S>
|
||||
void serialize(S& s, ParameterInfo& info) {
|
||||
s.value4b(info.id);
|
||||
s.container2b(info.title);
|
||||
s.container2b(info.shortTitle);
|
||||
s.container2b(info.units);
|
||||
s.value4b(info.stepCount);
|
||||
s.value8b(info.defaultNormalizedValue);
|
||||
s.value4b(info.unitId);
|
||||
s.value4b(info.flags);
|
||||
}
|
||||
} // namespace Vst
|
||||
} // namespace Steinberg
|
||||
|
||||
Reference in New Issue
Block a user