mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-13 20:09:59 +02:00
Make YaPluginFactory abstract
And add separate implementations for the native plugin and the Wine plugin host. This way we can easily allow the native host to do callbacks without having to manage a load of lambdas.
This commit is contained in:
@@ -43,9 +43,10 @@ instantiated and managed by the host. The model works as follows:
|
||||
can be sent between the native plugin and the Wine plugin host.
|
||||
6. If `IFoo` has methods that have side effects (such as instantiating a new
|
||||
object), then the implementations of those functions in `YaFoo` will be pure
|
||||
virtual and both the native plugin and the Wine plugin host should provide
|
||||
their own implementation. Since the functions will ever only be called from
|
||||
one of the two sides, the other side can just throw in their implementation.
|
||||
virtual. The side that requested the object (so for the plugin factory that
|
||||
would be on the side of the native plugin) should then provide a `YaFoo{Plugin,Host}Impl`
|
||||
that implements those functions through yabridge's `Vst3MessageHandler`
|
||||
callback interface.
|
||||
|
||||
## Plugin Factory
|
||||
|
||||
|
||||
@@ -119,24 +119,6 @@ tresult PLUGIN_API YaPluginFactory::getClassInfo(Steinberg::int32 index,
|
||||
}
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory::createInstance(Steinberg::FIDString /*cid*/,
|
||||
Steinberg::FIDString /*_iid*/,
|
||||
void** /*obj*/) {
|
||||
// TODO: Figure out how to implement this. Some considerations:
|
||||
// - We have to sent a control message to the Wine plugin host to ask
|
||||
// it to create an instance of `_iid`.
|
||||
// - We then create a `Ya*` implementation of the same interface on
|
||||
// the plugin side.
|
||||
// - These two should be wired up so that when the host calls a
|
||||
// function on it, it should be sent to the instance on the Wine
|
||||
// plugin host side with the same cid.
|
||||
// - We should have a list of interfaces we support. When we receive a
|
||||
// request to create an instance of something we don't support, then
|
||||
// we should log that and then fail.
|
||||
return 0;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory::getClassInfo2(int32 /*index*/,
|
||||
Steinberg::PClassInfo2* /*info*/) {
|
||||
@@ -150,10 +132,3 @@ YaPluginFactory::getClassInfoUnicode(int32 /*index*/,
|
||||
// TODO: Implement
|
||||
return 0;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory::setHostContext(Steinberg::FUnknown* /*context*/) {
|
||||
// TODO: I guess this should do a callback and set the Wine host's host
|
||||
// context, right?
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ class YaPluginFactory : public Steinberg::IPluginFactory3 {
|
||||
* TODO: Instead of a having a default constructor, we should probably be
|
||||
* passing a callback to this constructor that lets us communicate
|
||||
* with the Wine plugin host.
|
||||
* TODO: Alternative to requiring a bunch of `fu::unique_function<>`
|
||||
* callbacks would be to make the callback functions pure virtual, and
|
||||
* then implement those functions directly using `Vst3MessageHandler`.
|
||||
*/
|
||||
YaPluginFactory();
|
||||
|
||||
@@ -59,7 +62,7 @@ class YaPluginFactory : public Steinberg::IPluginFactory3 {
|
||||
explicit YaPluginFactory(
|
||||
Steinberg::IPtr<Steinberg::IPluginFactory> factory);
|
||||
|
||||
~YaPluginFactory();
|
||||
virtual ~YaPluginFactory();
|
||||
|
||||
DECLARE_FUNKNOWN_METHODS
|
||||
|
||||
@@ -68,9 +71,20 @@ class YaPluginFactory : public Steinberg::IPluginFactory3 {
|
||||
int32 PLUGIN_API countClasses() override;
|
||||
tresult PLUGIN_API getClassInfo(Steinberg::int32 index,
|
||||
Steinberg::PClassInfo* info) override;
|
||||
tresult PLUGIN_API createInstance(Steinberg::FIDString cid,
|
||||
Steinberg::FIDString _iid,
|
||||
void** obj) override;
|
||||
// TODO: Figure out how to implement this. Some considerations:
|
||||
// - We have to sent a control message to the Wine plugin host to ask
|
||||
// it to create an instance of `_iid`.
|
||||
// - We then create a `Ya*` implementation of the same interface on
|
||||
// the plugin side.
|
||||
// - These two should be wired up so that when the host calls a
|
||||
// function on it, it should be sent to the instance on the Wine
|
||||
// plugin host side with the same cid.
|
||||
// - We should have a list of interfaces we support. When we receive a
|
||||
// request to create an instance of something we don't support, then
|
||||
// we should log that and then fail.
|
||||
virtual tresult PLUGIN_API createInstance(Steinberg::FIDString cid,
|
||||
Steinberg::FIDString _iid,
|
||||
void** obj) override = 0;
|
||||
|
||||
// From `IPluginFactory2`
|
||||
tresult PLUGIN_API getClassInfo2(int32 index,
|
||||
@@ -79,7 +93,8 @@ class YaPluginFactory : public Steinberg::IPluginFactory3 {
|
||||
// From `IPluginFactory3`
|
||||
tresult PLUGIN_API
|
||||
getClassInfoUnicode(int32 index, Steinberg::PClassInfoW* info) override;
|
||||
tresult PLUGIN_API setHostContext(Steinberg::FUnknown* context) override;
|
||||
virtual tresult PLUGIN_API
|
||||
setHostContext(Steinberg::FUnknown* context) override = 0;
|
||||
|
||||
/**
|
||||
* The IIDs that the interface we serialized supports.
|
||||
|
||||
Reference in New Issue
Block a user