Implement IPluginFactory3::setHostContext()

Now the plugin factories are fully implemented (at least, functionality
wise, we still can't create most kinds of objects).
This commit is contained in:
Robbert van der Helm
2020-12-13 15:50:41 +01:00
parent 7c5f7a2e0e
commit 32c1028736
14 changed files with 95 additions and 24 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context,
sockets.connect();
// Initialize after communication has been set up
// We'll try to do the same `get_bridge_isntance` trick as in
// We'll try to do the same `get_bridge_instance` trick as in
// `plugin/plugin.cpp`, but since the plugin will probably call the host
// callback while it's initializing we sadly have to use a global here.
{
+13
View File
@@ -111,6 +111,19 @@ void Vst3Bridge::run() {
-> YaPluginFactory::Construct::Response {
return YaPluginFactory::ConstructArgs(
module->getFactory().get());
},
[&](YaPluginFactory::SetHostContext& request)
-> YaPluginFactory::SetHostContext::Response {
plugin_factory_host_application_context =
Steinberg::owned(new YaHostApplicationHostImpl(
*this,
std::move(request.host_application_context_args)));
Steinberg::FUnknownPtr<Steinberg::IPluginFactory3> factory_3(
module->getFactory().get());
assert(factory_3);
return factory_3->setHostContext(
plugin_factory_host_application_context);
}});
}
+7
View File
@@ -99,6 +99,13 @@ class Vst3Bridge : public HostBridge {
*/
std::atomic_size_t current_instance_id;
/**
* The host application context proxy object if we got passed a host
* application context during a call to `IPluginFactory3::setHostContext()`
* by the host.
*/
Steinberg::IPtr<YaHostApplication> plugin_factory_host_application_context;
// Below are managed instances we created for
// `IPluginFactory::createInstance()`. The keys in all of these maps are the
// unique identifiers we generated for them so we can identify specific