mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-16 00:13:55 +02:00
Allow instantiating IComponents
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
|
|
||||||
|
YaComponent::Arguments::Arguments() {}
|
||||||
|
|
||||||
YaComponent::Arguments::Arguments(
|
YaComponent::Arguments::Arguments(
|
||||||
Steinberg::IPtr<Steinberg::Vst::IComponent> component,
|
Steinberg::IPtr<Steinberg::Vst::IComponent> component,
|
||||||
size_t instance_id)
|
size_t instance_id)
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
|||||||
* These are the arguments for creating a `YaComponentPluginImpl`.
|
* These are the arguments for creating a `YaComponentPluginImpl`.
|
||||||
*/
|
*/
|
||||||
struct Arguments {
|
struct Arguments {
|
||||||
|
Arguments();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read arguments from an existing implementation.
|
* Read arguments from an existing implementation.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,10 +25,19 @@ tresult PLUGIN_API
|
|||||||
YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
|
YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
|
||||||
Steinberg::FIDString _iid,
|
Steinberg::FIDString _iid,
|
||||||
void** obj) {
|
void** obj) {
|
||||||
// TODO: Implement as specified in `src/common/serialization/vst3/README.md`
|
// TODO: Do the same thing for other types
|
||||||
|
ArrayUID cid_array;
|
||||||
|
std::copy(cid, cid + sizeof(Steinberg::TUID), cid_array.begin());
|
||||||
if (Steinberg::FIDStringsEqual(_iid, Steinberg::Vst::IComponent::iid)) {
|
if (Steinberg::FIDStringsEqual(_iid, Steinberg::Vst::IComponent::iid)) {
|
||||||
// TODO: Instantiate an IComponent as described above
|
std::optional<YaComponent::Arguments> args =
|
||||||
return Steinberg::kNotImplemented;
|
bridge.send_message(YaComponent::Create{.cid = cid_array});
|
||||||
|
if (args) {
|
||||||
|
// I find all of these raw pointers scary
|
||||||
|
*obj = new YaComponentPluginImpl(bridge, std::move(*args));
|
||||||
|
return Steinberg::kResultOk;
|
||||||
|
} else {
|
||||||
|
return Steinberg::kNotImplemented;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// When the host requests an interface we do not (yet) implement, we'll
|
// When the host requests an interface we do not (yet) implement, we'll
|
||||||
// print a recognizable log message. I don't think they include a safe
|
// print a recognizable log message. I don't think they include a safe
|
||||||
|
|||||||
Reference in New Issue
Block a user