Implement IUnitInfo::getProgramListCount

This commit is contained in:
Robbert van der Helm
2020-12-26 22:10:46 +01:00
parent 999cf45d6a
commit 92a7cb755a
6 changed files with 33 additions and 4 deletions
+7
View File
@@ -446,6 +446,13 @@ bool Vst3Logger::log_request(bool is_host_vst,
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaUnitInfo::GetProgramListCount& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id << ": IUnitInfo::getProgramListCount()";
});
}
bool Vst3Logger::log_request(
bool is_host_vst,
const YaAudioProcessor::SetBusArrangements& request) {
+1
View File
@@ -110,6 +110,7 @@ class Vst3Logger {
bool log_request(bool is_host_vst, const YaPluginFactory::SetHostContext&);
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 YaAudioProcessor::SetBusArrangements&);
+2 -1
View File
@@ -101,7 +101,8 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
YaPluginFactory::Construct,
YaPluginFactory::SetHostContext,
YaUnitInfo::GetUnitCount,
YaUnitInfo::GetUnitInfo>;
YaUnitInfo::GetUnitInfo,
YaUnitInfo::GetProgramListCount>;
template <typename S>
void serialize(S& s, ControlRequest& payload) {
@@ -115,6 +115,22 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
virtual tresult PLUGIN_API
getUnitInfo(int32 unitIndex,
Steinberg::Vst::UnitInfo& info /*out*/) override = 0;
/**
* Message to pass through a call to `IUnitInfo::getProgramListCount()` to
* the Wine plugin host.
*/
struct GetProgramListCount {
using Response = PrimitiveWrapper<int32>;
native_size_t instance_id;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
}
};
virtual int32 PLUGIN_API getProgramListCount() override = 0;
virtual tresult PLUGIN_API getProgramListInfo(
int32 listIndex,
@@ -458,9 +458,8 @@ Vst3PluginProxyImpl::getUnitInfo(int32 unitIndex,
}
int32 PLUGIN_API Vst3PluginProxyImpl::getProgramListCount() {
// TODO: Implement
bridge.logger.log("TODO: IUnitInfo::getProgramListCount()");
return Steinberg::kNotImplemented;
return bridge.send_message(
YaUnitInfo::GetProgramListCount{.instance_id = instance_id()});
}
tresult PLUGIN_API Vst3PluginProxyImpl::getProgramListInfo(
+5
View File
@@ -581,6 +581,11 @@ void Vst3Bridge::run() {
return YaUnitInfo::GetUnitInfoResponse{.result = result,
.info = info};
},
[&](const YaUnitInfo::GetProgramListCount& request)
-> YaUnitInfo::GetProgramListCount::Response {
return object_instances[request.instance_id]
.unit_info->getProgramListCount();
},
});
}