From 8e09d50a5463371fc94710f0531edebb953a77de Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 7 Dec 2020 15:29:02 +0100 Subject: [PATCH] Describe how createInstance() is going to work --- src/plugin/bridges/vst3-impls.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/plugin/bridges/vst3-impls.cpp b/src/plugin/bridges/vst3-impls.cpp index d47c4dcd..eee5c02b 100644 --- a/src/plugin/bridges/vst3-impls.cpp +++ b/src/plugin/bridges/vst3-impls.cpp @@ -20,9 +20,33 @@ YaPluginFactoryPluginImpl::YaPluginFactoryPluginImpl(Vst3PluginBridge& bridge) : bridge(bridge) {} tresult PLUGIN_API -YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString /*cid*/, - Steinberg::FIDString /*_iid*/, - void** /*obj*/) { +YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid, + Steinberg::FIDString _iid, + void** obj) { + // TODO: This should: + // 1. Check which interface `_iid` belongs to. Let's call this + // interface `T`. If we do not (yet) support it, then we should log + // it and return `Steinberg::kNotImplemented`. + // 2. Send a control message to the Wine plugin host to instantiate a + // new object of type `T` with `cid` and `_iid` as parameters. + // 3. On the Wine side this calls `createIntance()` on the module's + // factory with thsoe same `cid` and `_iid` arguments. + // 4. It this was successful, we'll assign this object a unique number + // (by just doing a fetch-and-add on an atomic size_t) so we can + // refer to it and add it to an `std::map` (could + // also throw everything in a single map with `FUnknown`s, but + // while more verbose this sounds much less prone to breakage). + // 5. We'll serialize any payload data into a `YaT` **which includes + // that unique identifier we generated** and send it back to the + // plugin. + // 6. The plugin then converts it to the correct smart pointer format + // and writes it to `obj`. We don't have to keep track of these + // objects on the plugin side and the reference counting pointers + // will cause everything to clean up after itself. + // 7. Since those `YaT` objects we'll return from `createInstance()` + // will have a reference to `Vst3PluginBridge`, they can also send + // control messages themselves. + // TODO: Send a control message return Steinberg::kNotImplemented; }