Implement IUnitInfo::getProgramListInfo

This commit is contained in:
Robbert van der Helm
2020-12-26 22:17:21 +01:00
parent 92a7cb755a
commit 60f6b30b84
6 changed files with 85 additions and 4 deletions
+22
View File
@@ -453,6 +453,15 @@ bool Vst3Logger::log_request(bool is_host_vst,
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaUnitInfo::GetProgramListInfo& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id
<< ": IUnitInfo::getProgramListInfo(listIndex = "
<< request.list_index << ", &info)";
});
}
bool Vst3Logger::log_request(
bool is_host_vst,
const YaAudioProcessor::SetBusArrangements& request) {
@@ -861,6 +870,19 @@ void Vst3Logger::log_response(bool is_host_vst,
});
}
void Vst3Logger::log_response(
bool is_host_vst,
const YaUnitInfo::GetProgramListInfoResponse& response) {
log_response_base(is_host_vst, [&](auto& message) {
message << response.result.string();
if (response.result == Steinberg::kResultOk) {
message << ", <ProgramListInfo for \""
<< VST3::StringConvert::convert(response.info.name)
<< "\">";
}
});
}
void Vst3Logger::log_response(
bool is_host_vst,
const YaAudioProcessor::GetBusArrangementResponse& response) {
+3
View File
@@ -111,6 +111,7 @@ class Vst3Logger {
bool log_request(bool is_host_vst, const YaUnitInfo::GetUnitCount&);
bool log_request(bool is_host_vst, const YaUnitInfo::GetUnitInfo&);
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 YaAudioProcessor::SetBusArrangements&);
@@ -165,6 +166,8 @@ class Vst3Logger {
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 YaUnitInfo::GetUnitInfoResponse&);
void log_response(bool is_host_vst,
const YaUnitInfo::GetProgramListInfoResponse&);
void log_response(bool is_host_vst,
const YaAudioProcessor::GetBusArrangementResponse&);
+2 -1
View File
@@ -102,7 +102,8 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
YaPluginFactory::SetHostContext,
YaUnitInfo::GetUnitCount,
YaUnitInfo::GetUnitInfo,
YaUnitInfo::GetProgramListCount>;
YaUnitInfo::GetProgramListCount,
YaUnitInfo::GetProgramListInfo>;
template <typename S>
void serialize(S& s, ControlRequest& payload) {
@@ -132,6 +132,40 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
};
virtual int32 PLUGIN_API getProgramListCount() override = 0;
/**
* The response code and returned unit information for a call to
* `IUnitInfo::getProgramListInfo(list_index)`.
*/
struct GetProgramListInfoResponse {
UniversalTResult result;
Steinberg::Vst::ProgramListInfo info;
template <typename S>
void serialize(S& s) {
s.object(result);
s.object(info);
}
};
/**
* Message to pass through a call to
* `IUnitInfo::getProgramListInfo(list_index)` to the Wine plugin host.
*/
struct GetProgramListInfo {
using Response = GetProgramListInfoResponse;
native_size_t instance_id;
int32 list_index;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.value4b(list_index);
}
};
virtual tresult PLUGIN_API getProgramListInfo(
int32 listIndex,
Steinberg::Vst::ProgramListInfo& info /*out*/) override = 0;
@@ -181,5 +215,12 @@ void serialize(S& s, UnitInfo& info) {
s.text2b(info.name);
s.value4b(info.programListId);
}
template <typename S>
void serialize(S& s, ProgramListInfo& info) {
s.value4b(info.id);
s.text2b(info.name);
s.value4b(info.programCount);
}
} // namespace Vst
} // namespace Steinberg
@@ -465,9 +465,13 @@ int32 PLUGIN_API Vst3PluginProxyImpl::getProgramListCount() {
tresult PLUGIN_API Vst3PluginProxyImpl::getProgramListInfo(
int32 listIndex,
Steinberg::Vst::ProgramListInfo& info /*out*/) {
// TODO: Implement
bridge.logger.log("TODO: IUnitInfo::getProgramListInfo()");
return Steinberg::kNotImplemented;
const GetProgramListInfoResponse response =
bridge.send_message(YaUnitInfo::GetProgramListInfo{
.instance_id = instance_id(), .list_index = listIndex});
info = response.info;
return response.result;
}
tresult PLUGIN_API
+10
View File
@@ -586,6 +586,16 @@ void Vst3Bridge::run() {
return object_instances[request.instance_id]
.unit_info->getProgramListCount();
},
[&](const YaUnitInfo::GetProgramListInfo& request)
-> YaUnitInfo::GetProgramListInfo::Response {
Steinberg::Vst::ProgramListInfo info;
const tresult result = object_instances[request.instance_id]
.unit_info->getProgramListInfo(
request.list_index, info);
return YaUnitInfo::GetProgramListInfoResponse{.result = result,
.info = info};
},
});
}