From 5b2221b25175fe41d7b0d11c6b0824ae43639349 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 29 Nov 2020 22:15:01 +0100 Subject: [PATCH] Add a (nonfunctional) VST3 entry point --- meson.build | 23 ++++++++++++++ src/plugin/vst3-plugin.cpp | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 src/plugin/vst3-plugin.cpp diff --git a/meson.build b/meson.build index 6c85793a..f1811ada 100644 --- a/meson.build +++ b/meson.build @@ -196,6 +196,29 @@ if with_vst3 link_with : vst3_sdk_hosting_wine, include_directories : vst3_include_dir, ) + + # This is the VST3 equivalent of `libyabridge-vst2.so`. The Wine host + # applications can handle both VST2 and VST3 plugins. + shared_library( + 'yabridge-vst3', + [ + 'src/common/logging.cpp', + 'src/plugin/vst3-plugin.cpp', + version_header, + ], + native : true, + include_directories : include_dir, + dependencies : [ + boost_dep, + boost_filesystem_dep, + bitsery_dep, + threads_dep, + tomlplusplus_dep, + vst3_sdk_native_dep, + ], + cpp_args : compiler_options, + link_args : ['-ldl'], + ) else message('VST3 support has been disabled') endif diff --git a/src/plugin/vst3-plugin.cpp b/src/plugin/vst3-plugin.cpp new file mode 100644 index 00000000..67f4df8b --- /dev/null +++ b/src/plugin/vst3-plugin.cpp @@ -0,0 +1,65 @@ +#include + +// TODO: Should you include this implementation file or copy everything over? +#include + +using Steinberg::gPluginFactory; + +// TODO: What should we do here? Also, note to self, don't forget to call these +// on the Wine host side if the host SDK doesn't already do that for us. +bool InitModule() { + return true; +} + +bool DeinitModule() { + return true; +} + +/** + * Our VST3 plugin's entry point. When building the plugin factory we'll host + * the plugin in our Wine application, retrieve its information and supported + * classes, and then recreate it here. + */ +SMTG_EXPORT_SYMBOL Steinberg::IPluginFactory* PLUGIN_API GetPluginFactory() { + // TODO: So from this I can imagine that the host is supposed to keep this + // module loaded into memory and reuse it for multiple plugins? How + // should Wine host instances be tied to native plugin instances? + if (!gPluginFactory) { + // TODO: Here we want to: + // 1) Load the plugin on the Wine host + // 2) Create a factory using the plugins PFactoryInfo + // 3) Get all PClassInfo{,2,W} objects from the plugin, register + // those classes. + // + // We should wrap this in our `Vst3PluginBridge` + + // static Steinberg::PFactoryInfo factoryInfo(vendor, url, email, + // flags); gPluginFactory = new Steinberg::CPluginFactory(factoryInfo); + + // + // { + // Steinberg::TUID lcid = cid; + // static Steinberg::PClassInfo componentClass(lcid, cardinality, + // category, name); + // gPluginFactory->registerClass(&componentClass, createMethod); + // } + // { + // Steinberg::TUID lcid = cid; + // static Steinberg::PClassInfo2 componentClass( + // lcid, cardinality, category, name, classFlags, subCategories, + // 0, version, sdkVersion); + // gPluginFactory->registerClass(&componentClass, createMethod); + // } + // { + // TUID lcid = cid; + // static Steinberg::PClassInfoW componentClass( + // lcid, cardinality, category, name, classFlags, subCategories, + // 0, version, sdkVersion); + // gPluginFactory->registerClass(&componentClass, createMethod); + // } + } else { + gPluginFactory->addRef(); + } + + return gPluginFactory; +}