mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Describe how createInstance() is going to work
This commit is contained in:
@@ -20,9 +20,33 @@ YaPluginFactoryPluginImpl::YaPluginFactoryPluginImpl(Vst3PluginBridge& bridge)
|
|||||||
: bridge(bridge) {}
|
: bridge(bridge) {}
|
||||||
|
|
||||||
tresult PLUGIN_API
|
tresult PLUGIN_API
|
||||||
YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString /*cid*/,
|
YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
|
||||||
Steinberg::FIDString /*_iid*/,
|
Steinberg::FIDString _iid,
|
||||||
void** /*obj*/) {
|
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<size_t, IPtr<T>` (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
|
// TODO: Send a control message
|
||||||
return Steinberg::kNotImplemented;
|
return Steinberg::kNotImplemented;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user