Use the new approach for creating plugin factory

Directly serializing and deserializing into objects was and more
boilerplate heavy (since we now need two implementations even though we
only use one), and also much less flexible because we can't wrap
payloads in structs or provide optional values that way.
This commit is contained in:
Robbert van der Helm
2020-12-12 21:51:06 +01:00
parent 1b30000147
commit 39984ad442
14 changed files with 151 additions and 204 deletions
+4 -8
View File
@@ -17,7 +17,6 @@
#include "vst3.h"
#include "../boost-fix.h"
#include "vst3-impls.h"
#include <public.sdk/source/vst/hosting/module_win32.cpp>
@@ -36,11 +35,6 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
sockets.connect();
// Serialize the plugin's plugin factory. The native VST3 plugin will
// request a copy of this during its initialization.
plugin_factory =
std::make_unique<YaPluginFactoryHostImpl>(module->getFactory().get());
// Fetch this instance's configuration from the plugin to finish the setup
// process
config = sockets.vst_host_callback.send_message(WantsConfiguration{},
@@ -82,8 +76,10 @@ void Vst3Bridge::run() {
-> YaComponent::Terminate::Response {
return component_instances[request.instance_id]->terminate();
},
[&](const WantsPluginFactory&) -> WantsPluginFactory::Response {
return *plugin_factory;
[&](const YaPluginFactory::Construct&)
-> YaPluginFactory::Construct::Response {
return YaPluginFactory::ConstructArgs(
module->getFactory().get());
}});
}