Implement IUnitInfo::getSelectedUnit

This commit is contained in:
Robbert van der Helm
2020-12-27 16:48:47 +01:00
parent fbef37b924
commit 70c5792593
6 changed files with 33 additions and 4 deletions
+7
View File
@@ -503,6 +503,13 @@ bool Vst3Logger::log_request(bool is_host_vst,
});
}
bool Vst3Logger::log_request(bool is_host_vst,
const YaUnitInfo::GetSelectedUnit& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id << ": IUnitInfo::getSelectedUnit()";
});
}
bool Vst3Logger::log_request(
bool is_host_vst,
const YaAudioProcessor::SetBusArrangements& request) {
+1
View File
@@ -116,6 +116,7 @@ class Vst3Logger {
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramInfo&);
bool log_request(bool is_host_vst, const YaUnitInfo::HasProgramPitchNames&);
bool log_request(bool is_host_vst, const YaUnitInfo::GetProgramPitchName&);
bool log_request(bool is_host_vst, const YaUnitInfo::GetSelectedUnit&);
bool log_request(bool is_host_vst,
const YaAudioProcessor::SetBusArrangements&);
+2 -1
View File
@@ -107,7 +107,8 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
YaUnitInfo::GetProgramName,
YaUnitInfo::GetProgramInfo,
YaUnitInfo::HasProgramPitchNames,
YaUnitInfo::GetProgramPitchName>;
YaUnitInfo::GetProgramPitchName,
YaUnitInfo::GetSelectedUnit>;
template <typename S>
void serialize(S& s, ControlRequest& payload) {
@@ -324,6 +324,22 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
int32 programIndex,
int16 midiPitch,
Steinberg::Vst::String128 name /*out*/) override = 0;
/**
* Message to pass through a call to `IUnitInfo::getSelectedUnit()` to the
* Wine plugin host.
*/
struct GetSelectedUnit {
using Response = PrimitiveWrapper<Steinberg::Vst::UnitID>;
native_size_t instance_id;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
}
};
virtual Steinberg::Vst::UnitID PLUGIN_API getSelectedUnit() override = 0;
virtual tresult PLUGIN_API
selectUnit(Steinberg::Vst::UnitID unitId) override = 0;
@@ -536,9 +536,8 @@ tresult PLUGIN_API Vst3PluginProxyImpl::getProgramPitchName(
}
Steinberg::Vst::UnitID PLUGIN_API Vst3PluginProxyImpl::getSelectedUnit() {
// TODO: Implement
bridge.logger.log("TODO: IUnitInfo::getSelectedUnit()");
return Steinberg::kNotImplemented;
return bridge.send_message(
YaUnitInfo::GetSelectedUnit{.instance_id = instance_id()});
}
tresult PLUGIN_API
+5
View File
@@ -639,6 +639,11 @@ void Vst3Bridge::run() {
return YaUnitInfo::GetProgramPitchNameResponse{
.result = result, .name = tchar_pointer_to_u16string(name)};
},
[&](const YaUnitInfo::GetSelectedUnit& request)
-> YaUnitInfo::GetSelectedUnit::Response {
return object_instances[request.instance_id]
.unit_info->getSelectedUnit();
},
});
}