Implement plugin side of IPluginBase::initialize()

This commit is contained in:
Robbert van der Helm
2020-12-13 14:30:51 +01:00
parent e8929e5e43
commit e21ee31ee8
7 changed files with 62 additions and 9 deletions
+1
View File
@@ -59,6 +59,7 @@ struct WantsConfiguration {
*/
using ControlRequest = std::variant<YaComponent::Construct,
YaComponent::Destruct,
YaComponent::Initialize,
YaComponent::Terminate,
YaPluginFactory::Construct>;
+24
View File
@@ -27,6 +27,7 @@
#include "../common.h"
#include "base.h"
#include "host-application.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
@@ -125,6 +126,29 @@ class YaComponent : public Steinberg::Vst::IComponent {
DECLARE_FUNKNOWN_METHODS
// From `IPluginBase`
/**
* Message to pass through a call to `IPluginBase::initialize()` to the Wine
* plugin host. if we pass an `IHostApplication` instance, then a proxy
* `YaHostApplication` should be created and passed as an argument to
* `IPluginBase::initialize()`. If this is absent a null pointer should be
* passed. The lifetime of this `YaHostApplication` object should be bound
* to the `IComponent` we are proxying.
*/
struct Initialize {
using Response = UniversalTResult;
native_size_t instance_id;
std::optional<YaHostApplication::ConstructArgs>
host_application_context_args;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.ext(host_application_context_args, bitsery::ext::StdOptional{});
}
};
virtual tresult PLUGIN_API initialize(FUnknown* context) override = 0;
/**
@@ -68,7 +68,7 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
void serialize(S& s) {
s.value8b(component_instance_id);
s.ext(name, bitsery::ext::StdOptional{},
[](S& s, std::string& name) {
[](S& s, std::u16string& name) {
s.text2b(name, std::extent_v<Steinberg::Vst::String128>);
});
}
@@ -78,9 +78,9 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
* Instantiate this instance with arguments read from an actual host
* context.
*
* @note Since this is passed as part of ``IPluginBase::intialize()` and
* `IPluginFactory3::setHostContext()``, there are no direct `Construct`
* or `Destruct` messages. This object's lifetime is bound to that of the
* @note Since this is passed as part of `IPluginBase::intialize()` and
* `IPluginFactory3::setHostContext()`, there are no direct `Construct` or
* `Destruct` messages. This object's lifetime is bound to that of the
* objects they are passed to. If those objects get dropped, then the host
* contexts should also be dropped.
*