Reload supported interfaces after IPluginBase::initialize()

This is needed as a workaround to support Waves VST3 plugins.

Right now does does not actually fix the issue because the arguments are
not updated in the subclasses. The next commit will fix this.
This commit is contained in:
Robbert van der Helm
2021-07-05 16:03:39 +02:00
parent 3fbb01f225
commit 1397400155
8 changed files with 119 additions and 48 deletions
+48 -1
View File
@@ -232,6 +232,53 @@ class Vst3PluginProxy : public YaAudioPresentationLatency,
*/
inline size_t instance_id() const noexcept { return arguments.instance_id; }
// These have to be defined here instead of in `YaPluginBase` because we
// need to reference the `ConstructArgs`
/**
* The response code and updated supported interface list after a call to
* `IPluginBase::initialize()`.
*
* HACK: This is needed to support Waves VST3 plugins because they only
* expose the edit controller interface after this point
*/
struct InitializeResponse {
UniversalTResult result;
// This is a very ugly hack, but we'll just have to requery all
// supported interfaces and replace the original constructargs in the
// plugin-side proxy object
Vst3PluginProxy::ConstructArgs updated_plugin_interfaces;
template <typename S>
void serialize(S& s) {
s.object(result);
s.object(updated_plugin_interfaces);
}
};
/**
* Message to pass through a call to `IPluginBase::initialize()` to the Wine
* plugin host. We will read what interfaces the passed context object
* implements so we can then create a proxy object on the Wine side that the
* plugin can use to make callbacks with. The lifetime of this
* `Vst3HostContextProxy` object should be bound to the `IComponent` we are
* proxying.
*/
struct Initialize {
using Response = InitializeResponse;
native_size_t instance_id;
Vst3HostContextProxy::ConstructArgs host_context_args;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.object(host_context_args);
}
};
// We'll define messages for functions that have identical definitions in
// multiple interfaces below. When the Wine plugin host process handles
// these it should check which of the interfaces is supported on the host.
@@ -287,7 +334,7 @@ class Vst3PluginProxy : public YaAudioPresentationLatency,
}
};
private:
protected:
ConstructArgs arguments;
};
@@ -63,28 +63,9 @@ class YaPluginBase : public Steinberg::IPluginBase {
inline bool supported() const noexcept { return arguments.supported; }
/**
* Message to pass through a call to `IPluginBase::initialize()` to the Wine
* plugin host. We will read what interfaces the passed context object
* implements so we can then create a proxy object on the Wine side that the
* plugin can use to make callbacks with. The lifetime of this
* `Vst3HostContextProxy` object should be bound to the `IComponent` we are
* proxying.
*/
struct Initialize {
using Response = UniversalTResult;
native_size_t instance_id;
Vst3HostContextProxy::ConstructArgs host_context_args;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.object(host_context_args);
}
};
// The request and response for `IPluginBase::initialize()` is defined
// within `Vst3PluginProxy` because it (thanks to Waves) requires all
// supported interfaces to be queried again
virtual tresult PLUGIN_API initialize(FUnknown* context) override = 0;
/**