mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Implement IUnitInfo::getProgramInfo
This commit is contained in:
@@ -471,6 +471,17 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Vst3Logger::log_request(bool is_host_vst,
|
||||||
|
const YaUnitInfo::GetProgramInfo& request) {
|
||||||
|
return log_request_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << request.instance_id
|
||||||
|
<< ": IUnitInfo::getProgramInfo(listId = " << request.list_id
|
||||||
|
<< ", programIndex = " << request.program_index
|
||||||
|
<< ", attributeId = " << request.attribute_id
|
||||||
|
<< ", &attributeValue)";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
bool Vst3Logger::log_request(
|
bool Vst3Logger::log_request(
|
||||||
bool is_host_vst,
|
bool is_host_vst,
|
||||||
const YaAudioProcessor::SetBusArrangements& request) {
|
const YaAudioProcessor::SetBusArrangements& request) {
|
||||||
@@ -904,6 +915,19 @@ void Vst3Logger::log_response(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vst3Logger::log_response(
|
||||||
|
bool is_host_vst,
|
||||||
|
const YaUnitInfo::GetProgramInfoResponse& response) {
|
||||||
|
log_response_base(is_host_vst, [&](auto& message) {
|
||||||
|
message << response.result.string();
|
||||||
|
if (response.result == Steinberg::kResultOk) {
|
||||||
|
message << ", \""
|
||||||
|
<< VST3::StringConvert::convert(response.attribute_value)
|
||||||
|
<< "\"";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Vst3Logger::log_response(
|
void Vst3Logger::log_response(
|
||||||
bool is_host_vst,
|
bool is_host_vst,
|
||||||
const YaAudioProcessor::GetBusArrangementResponse& response) {
|
const YaAudioProcessor::GetBusArrangementResponse& response) {
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ class Vst3Logger {
|
|||||||
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramListCount&);
|
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramListCount&);
|
||||||
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramListInfo&);
|
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramListInfo&);
|
||||||
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramName&);
|
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramName&);
|
||||||
|
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramInfo&);
|
||||||
|
|
||||||
bool log_request(bool is_host_vst,
|
bool log_request(bool is_host_vst,
|
||||||
const YaAudioProcessor::SetBusArrangements&);
|
const YaAudioProcessor::SetBusArrangements&);
|
||||||
@@ -171,6 +172,8 @@ class Vst3Logger {
|
|||||||
const YaUnitInfo::GetProgramListInfoResponse&);
|
const YaUnitInfo::GetProgramListInfoResponse&);
|
||||||
void log_response(bool is_host_vst,
|
void log_response(bool is_host_vst,
|
||||||
const YaUnitInfo::GetProgramNameResponse&);
|
const YaUnitInfo::GetProgramNameResponse&);
|
||||||
|
void log_response(bool is_host_vst,
|
||||||
|
const YaUnitInfo::GetProgramInfoResponse&);
|
||||||
|
|
||||||
void log_response(bool is_host_vst,
|
void log_response(bool is_host_vst,
|
||||||
const YaAudioProcessor::GetBusArrangementResponse&);
|
const YaAudioProcessor::GetBusArrangementResponse&);
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
|||||||
YaUnitInfo::GetUnitInfo,
|
YaUnitInfo::GetUnitInfo,
|
||||||
YaUnitInfo::GetProgramListCount,
|
YaUnitInfo::GetProgramListCount,
|
||||||
YaUnitInfo::GetProgramListInfo,
|
YaUnitInfo::GetProgramListInfo,
|
||||||
YaUnitInfo::GetProgramName>;
|
YaUnitInfo::GetProgramName,
|
||||||
|
YaUnitInfo::GetProgramInfo>;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s, ControlRequest& payload) {
|
void serialize(S& s, ControlRequest& payload) {
|
||||||
|
|||||||
@@ -210,6 +210,45 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
|
|||||||
getProgramName(Steinberg::Vst::ProgramListID listId,
|
getProgramName(Steinberg::Vst::ProgramListID listId,
|
||||||
int32 programIndex,
|
int32 programIndex,
|
||||||
Steinberg::Vst::String128 name /*out*/) override = 0;
|
Steinberg::Vst::String128 name /*out*/) override = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The response code and returned name for a call to
|
||||||
|
* `IUnitInfo::getPrograminfo(list_id, program_index, attribute_name,
|
||||||
|
* &attribute_value)`.
|
||||||
|
*/
|
||||||
|
struct GetProgramInfoResponse {
|
||||||
|
UniversalTResult result;
|
||||||
|
std::u16string attribute_value;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.object(result);
|
||||||
|
s.text2b(attribute_value, std::extent_v<Steinberg::Vst::String128>);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message to pass through a call to `IUnitInfo::getProgramInfo(list_id,
|
||||||
|
* program_index, attribute_id, &attribute_value)` to the Wine plugin host.
|
||||||
|
*/
|
||||||
|
struct GetProgramInfo {
|
||||||
|
using Response = GetProgramInfoResponse;
|
||||||
|
|
||||||
|
native_size_t instance_id;
|
||||||
|
|
||||||
|
Steinberg::Vst::ProgramListID list_id;
|
||||||
|
int32 program_index;
|
||||||
|
std::string attribute_id;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(instance_id);
|
||||||
|
s.value4b(list_id);
|
||||||
|
s.value4b(program_index);
|
||||||
|
s.text1b(attribute_id, 256);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
virtual tresult PLUGIN_API getProgramInfo(
|
virtual tresult PLUGIN_API getProgramInfo(
|
||||||
Steinberg::Vst::ProgramListID listId,
|
Steinberg::Vst::ProgramListID listId,
|
||||||
int32 programIndex,
|
int32 programIndex,
|
||||||
|
|||||||
@@ -494,9 +494,19 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getProgramInfo(
|
|||||||
int32 programIndex,
|
int32 programIndex,
|
||||||
Steinberg::Vst::CString attributeId /*in*/,
|
Steinberg::Vst::CString attributeId /*in*/,
|
||||||
Steinberg::Vst::String128 attributeValue /*out*/) {
|
Steinberg::Vst::String128 attributeValue /*out*/) {
|
||||||
// TODO: Implement
|
assert(attributeId);
|
||||||
bridge.logger.log("TODO: IUnitInfo::getProgramInfo()");
|
|
||||||
return Steinberg::kNotImplemented;
|
const GetProgramInfoResponse response = bridge.send_message(
|
||||||
|
YaUnitInfo::GetProgramInfo{.instance_id = instance_id(),
|
||||||
|
.list_id = listId,
|
||||||
|
.program_index = programIndex,
|
||||||
|
.attribute_id = attributeId});
|
||||||
|
|
||||||
|
std::copy(response.attribute_value.begin(), response.attribute_value.end(),
|
||||||
|
attributeValue);
|
||||||
|
attributeValue[response.attribute_value.size()] = 0;
|
||||||
|
|
||||||
|
return response.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
tresult PLUGIN_API
|
tresult PLUGIN_API
|
||||||
|
|||||||
@@ -607,6 +607,20 @@ void Vst3Bridge::run() {
|
|||||||
return YaUnitInfo::GetProgramNameResponse{
|
return YaUnitInfo::GetProgramNameResponse{
|
||||||
.result = result, .name = tchar_pointer_to_u16string(name)};
|
.result = result, .name = tchar_pointer_to_u16string(name)};
|
||||||
},
|
},
|
||||||
|
[&](const YaUnitInfo::GetProgramInfo& request)
|
||||||
|
-> YaUnitInfo::GetProgramInfo::Response {
|
||||||
|
Steinberg::Vst::String128 attribute_value{0};
|
||||||
|
const tresult result =
|
||||||
|
object_instances[request.instance_id]
|
||||||
|
.unit_info->getProgramInfo(
|
||||||
|
request.list_id, request.program_index,
|
||||||
|
request.attribute_id.c_str(), attribute_value);
|
||||||
|
|
||||||
|
return YaUnitInfo::GetProgramInfoResponse{
|
||||||
|
.result = result,
|
||||||
|
.attribute_value =
|
||||||
|
tchar_pointer_to_u16string(attribute_value)};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user