mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
Redesign how interface instantiation works
Transferring some argument pack is much easier than trying to deserialize into an existing object when you also have to transfer more information than just that object.
This commit is contained in:
@@ -16,14 +16,19 @@
|
||||
|
||||
#include "component.h"
|
||||
|
||||
YaComponent::YaComponent(){FUNKNOWN_CTOR}
|
||||
|
||||
YaComponent::YaComponent(
|
||||
Steinberg::IPtr<Steinberg::Vst::IComponent> component) {
|
||||
FUNKNOWN_CTOR
|
||||
|
||||
YaComponent::Arguments::Arguments(
|
||||
Steinberg::IPtr<Steinberg::Vst::IComponent> component,
|
||||
size_t instance_id)
|
||||
: instance_id(instance_id) {
|
||||
// `IComponent::getControllerClassId`
|
||||
component->getControllerClassId(edit_controller_cid);
|
||||
Steinberg::TUID cid;
|
||||
if (component->getControllerClassId(cid) == Steinberg::kResultOk) {
|
||||
edit_controller_cid = std::to_array(cid);
|
||||
}
|
||||
}
|
||||
|
||||
YaComponent::YaComponent(const Arguments&& args) : arguments(std::move(args)) {
|
||||
FUNKNOWN_CTOR
|
||||
|
||||
// Everything else is handled directly through callbacks to minimize the
|
||||
// potential for errors
|
||||
@@ -49,3 +54,13 @@ tresult PLUGIN_API YaComponent::queryInterface(Steinberg::FIDString _iid,
|
||||
*obj = nullptr;
|
||||
return Steinberg::kNoInterface;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaComponent::getControllerClassId(Steinberg::TUID classId) {
|
||||
if (arguments.edit_controller_cid) {
|
||||
std::copy(arguments.edit_controller_cid->begin(),
|
||||
arguments.edit_controller_cid->end(), classId);
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kNotImplemented;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user