mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Implement IEditController::getParameterInfo()
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "vst3.h"
|
#include "vst3.h"
|
||||||
|
|
||||||
|
#include <public.sdk/source/vst/utility/stringconvert.h>
|
||||||
|
|
||||||
#include "src/common/serialization/vst3.h"
|
#include "src/common/serialization/vst3.h"
|
||||||
|
|
||||||
Vst3Logger::Vst3Logger(Logger& generic_logger) : logger(generic_logger) {}
|
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,
|
void Vst3Logger::log_request(bool is_host_vst,
|
||||||
const YaPluginBase::Initialize& request) {
|
const YaPluginBase::Initialize& request) {
|
||||||
log_request_base(is_host_vst, [&](auto& message) {
|
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,
|
void Vst3Logger::log_response(bool is_host_vst,
|
||||||
const YaPluginFactory::ConstructArgs& args) {
|
const YaPluginFactory::ConstructArgs& args) {
|
||||||
log_response_base(is_host_vst, [&](auto& message) {
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ class Vst3Logger {
|
|||||||
const YaEditController2::SetComponentState&);
|
const YaEditController2::SetComponentState&);
|
||||||
void log_request(bool is_host_vst,
|
void log_request(bool is_host_vst,
|
||||||
const YaEditController2::GetParameterCount&);
|
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::Initialize&);
|
||||||
void log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
void log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
||||||
void log_request(bool is_host_vst, const YaPluginFactory::Construct&);
|
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::GetBusInfoResponse&);
|
||||||
void log_response(bool is_host_vst,
|
void log_response(bool is_host_vst,
|
||||||
const YaComponent::GetRoutingInfoResponse&);
|
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 YaPluginFactory::ConstructArgs&);
|
||||||
void log_response(bool is_host_vst, const Configuration&);
|
void log_response(bool is_host_vst, const Configuration&);
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ using ControlRequest = std::variant<Vst3PluginProxy::Construct,
|
|||||||
YaComponent::SetActive,
|
YaComponent::SetActive,
|
||||||
YaEditController2::SetComponentState,
|
YaEditController2::SetComponentState,
|
||||||
YaEditController2::GetParameterCount,
|
YaEditController2::GetParameterCount,
|
||||||
|
YaEditController2::GetParameterInfo,
|
||||||
YaPluginBase::Initialize,
|
YaPluginBase::Initialize,
|
||||||
YaPluginBase::Terminate,
|
YaPluginBase::Terminate,
|
||||||
YaPluginFactory::Construct,
|
YaPluginFactory::Construct,
|
||||||
|
|||||||
@@ -124,6 +124,43 @@ class YaEditController2 : public Steinberg::Vst::IEditController,
|
|||||||
};
|
};
|
||||||
|
|
||||||
virtual int32 PLUGIN_API getParameterCount() override = 0;
|
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
|
virtual tresult PLUGIN_API
|
||||||
getParameterInfo(int32 paramIndex,
|
getParameterInfo(int32 paramIndex,
|
||||||
Steinberg::Vst::ParameterInfo& info /*out*/) override = 0;
|
Steinberg::Vst::ParameterInfo& info /*out*/) override = 0;
|
||||||
@@ -163,3 +200,19 @@ class YaEditController2 : public Steinberg::Vst::IEditController,
|
|||||||
};
|
};
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#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
|
||||||
|
|||||||
@@ -202,9 +202,15 @@ int32 PLUGIN_API Vst3PluginProxyImpl::getParameterCount() {
|
|||||||
tresult PLUGIN_API Vst3PluginProxyImpl::getParameterInfo(
|
tresult PLUGIN_API Vst3PluginProxyImpl::getParameterInfo(
|
||||||
int32 paramIndex,
|
int32 paramIndex,
|
||||||
Steinberg::Vst::ParameterInfo& info /*out*/) {
|
Steinberg::Vst::ParameterInfo& info /*out*/) {
|
||||||
// TODO: Implement
|
const GetParameterInfoResponse response =
|
||||||
bridge.logger.log("TODO IEditController::getParameterInfo()");
|
bridge.send_message(YaEditController2::GetParameterInfo{
|
||||||
return Steinberg::kNotImplemented;
|
.instance_id = arguments.instance_id,
|
||||||
|
.param_index = paramIndex,
|
||||||
|
.info = info});
|
||||||
|
|
||||||
|
info = response.updated_info;
|
||||||
|
|
||||||
|
return response.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API Vst3PluginProxyImpl::getParamStringByValue(
|
tresult PLUGIN_API Vst3PluginProxyImpl::getParamStringByValue(
|
||||||
|
|||||||
@@ -237,11 +237,21 @@ void Vst3Bridge::run() {
|
|||||||
return object_instances[request.instance_id]
|
return object_instances[request.instance_id]
|
||||||
.edit_controller->setComponentState(&request.state);
|
.edit_controller->setComponentState(&request.state);
|
||||||
},
|
},
|
||||||
[&](YaEditController2::GetParameterCount& request)
|
[&](const YaEditController2::GetParameterCount& request)
|
||||||
-> YaEditController2::GetParameterCount::Response {
|
-> YaEditController2::GetParameterCount::Response {
|
||||||
return object_instances[request.instance_id]
|
return object_instances[request.instance_id]
|
||||||
.edit_controller->getParameterCount();
|
.edit_controller->getParameterCount();
|
||||||
},
|
},
|
||||||
|
[&](YaEditController2::GetParameterInfo& request)
|
||||||
|
-> YaEditController2::GetParameterInfo::Response {
|
||||||
|
const tresult result =
|
||||||
|
object_instances[request.instance_id]
|
||||||
|
.edit_controller->getParameterInfo(request.param_index,
|
||||||
|
request.info);
|
||||||
|
|
||||||
|
return YaEditController2::GetParameterInfoResponse{
|
||||||
|
.result = result, .updated_info = request.info};
|
||||||
|
},
|
||||||
[&](YaPluginBase::Initialize& request)
|
[&](YaPluginBase::Initialize& request)
|
||||||
-> YaPluginBase::Initialize::Response {
|
-> YaPluginBase::Initialize::Response {
|
||||||
// If we got passed a host context, we'll create a proxy object
|
// If we got passed a host context, we'll create a proxy object
|
||||||
|
|||||||
Reference in New Issue
Block a user