Implement IUnitInfo::getUnitInfo

This commit is contained in:
Robbert van der Helm
2020-12-26 22:03:26 +01:00
parent f3e706a39a
commit 5e832a2689
7 changed files with 96 additions and 9 deletions
@@ -32,6 +32,9 @@
* part of `Vst3PluginProxy`. Event though `IComponent` inherits from
* `IPlguinBase`, we'll implement that separately in `YaPluginBase` because
* `IEditController` also inherits from `IPluginBase`.
*
* TODO: Remove the original fields for out parameters in the structs. They're
* really supposed to be empty.
*/
class YaComponent : public Steinberg::Vst::IComponent {
public:
@@ -78,6 +78,40 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
};
virtual int32 PLUGIN_API getUnitCount() override = 0;
/**
* The response code and returned unit information for a call to
* `IUnitInfo::getUnitInfo(unit_index)`.
*/
struct GetUnitInfoResponse {
UniversalTResult result;
Steinberg::Vst::UnitInfo info;
template <typename S>
void serialize(S& s) {
s.object(result);
s.object(info);
}
};
/**
* Message to pass through a call to `IUnitInfo::getUnitInfo(unit_index)` to
* the Wine plugin host.
*/
struct GetUnitInfo {
using Response = GetUnitInfoResponse;
native_size_t instance_id;
int32 unit_index;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.value4b(unit_index);
}
};
virtual tresult PLUGIN_API
getUnitInfo(int32 unitIndex,
Steinberg::Vst::UnitInfo& info /*out*/) override = 0;
@@ -121,3 +155,15 @@ class YaUnitInfo : public Steinberg::Vst::IUnitInfo {
};
#pragma GCC diagnostic pop
namespace Steinberg {
namespace Vst {
template <typename S>
void serialize(S& s, UnitInfo& info) {
s.value4b(info.id);
s.value4b(info.parentUnitId);
s.text2b(info.name);
s.value4b(info.programListId);
}
} // namespace Vst
} // namespace Steinberg