mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Store host pointer in the plugin proxy
This commit is contained in:
@@ -85,7 +85,7 @@ clap_plugin_factory_proxy::plugin_factory_create_plugin(
|
||||
// correct plugin instance, and callbacks made from the plugin to the
|
||||
// correct host instance.
|
||||
self->bridge_.register_plugin_proxy(std::make_unique<clap_plugin_proxy>(
|
||||
self->bridge_, *response.instance_id, *descriptor));
|
||||
self->bridge_, *response.instance_id, *descriptor, host));
|
||||
|
||||
const auto& [plugin_proxy, _] =
|
||||
self->bridge_.get_proxy(*response.instance_id);
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
|
||||
clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
|
||||
size_t instance_id,
|
||||
clap::plugin::Descriptor descriptor)
|
||||
clap::plugin::Descriptor descriptor,
|
||||
const clap_host_t* host)
|
||||
: bridge_(bridge),
|
||||
instance_id_(instance_id),
|
||||
descriptor_(std::move(descriptor)),
|
||||
host_(host),
|
||||
plugin_vtable_(clap_plugin_t{
|
||||
.desc = descriptor_.get(),
|
||||
.plugin_data = this,
|
||||
|
||||
@@ -38,7 +38,8 @@ class clap_plugin_proxy {
|
||||
*/
|
||||
clap_plugin_proxy(ClapPluginBridge& bridge,
|
||||
size_t instance_id,
|
||||
clap::plugin::Descriptor descriptor);
|
||||
clap::plugin::Descriptor descriptor,
|
||||
const clap_host_t* host);
|
||||
|
||||
clap_plugin_proxy(const clap_plugin_proxy&) = delete;
|
||||
clap_plugin_proxy& operator=(const clap_plugin_proxy&) = delete;
|
||||
@@ -82,6 +83,12 @@ class clap_plugin_proxy {
|
||||
size_t instance_id_;
|
||||
clap::plugin::Descriptor descriptor_;
|
||||
|
||||
/**
|
||||
* The `clap_host_t*` passed when creating the instance. Any callbacks made
|
||||
* by the proxied plugin instance must go through ere.
|
||||
*/
|
||||
const clap_host_t* host_;
|
||||
|
||||
/**
|
||||
* The vtable for `clap_plugin`, requires that this object is never moved or
|
||||
* copied. We'll use the host data pointer instead of placing this vtable at
|
||||
|
||||
Reference in New Issue
Block a user