mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Implement CLAP plugin initialization
This commit is contained in:
@@ -25,7 +25,6 @@ clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
|
||||
: bridge_(bridge),
|
||||
instance_id_(instance_id),
|
||||
descriptor_(std::move(descriptor)),
|
||||
host_(host),
|
||||
plugin_vtable_(clap_plugin_t{
|
||||
.desc = descriptor_.get(),
|
||||
.plugin_data = this,
|
||||
@@ -39,14 +38,23 @@ clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
|
||||
.process = plugin_process,
|
||||
.get_extension = plugin_get_extension,
|
||||
.on_main_thread = plugin_on_main_thread,
|
||||
}) {}
|
||||
}),
|
||||
host_(host) {}
|
||||
|
||||
bool CLAP_ABI clap_plugin_proxy::plugin_init(const struct clap_plugin* plugin) {
|
||||
assert(plugin && plugin->plugin_data);
|
||||
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
||||
auto self = static_cast<clap_plugin_proxy*>(plugin->plugin_data);
|
||||
|
||||
// TODO: Implement
|
||||
return false;
|
||||
const clap::plugin::InitResponse response =
|
||||
self->bridge_.send_main_thread_message(
|
||||
clap::plugin::Init{.instance_id = self->instance_id(),
|
||||
.supported_host_extensions = *self->host_});
|
||||
|
||||
// This determines which extensions the host is allowed to query in
|
||||
// `clap_plugin::get_extension()`
|
||||
self->supported_extensions_ = response.supported_plugin_extensions;
|
||||
|
||||
return response.result;
|
||||
}
|
||||
|
||||
void CLAP_ABI
|
||||
|
||||
@@ -83,16 +83,23 @@ 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
|
||||
* the start of the struct and directly casting the `clap_plugin_t*`.
|
||||
*/
|
||||
const clap_plugin_t plugin_vtable_;
|
||||
|
||||
/**
|
||||
* The extensions supported by the bridged plugin. Set after a successful
|
||||
* `clap_plugin::init()` call. We'll allow the host to query these same
|
||||
* extensions from our plugin proxy.
|
||||
*/
|
||||
clap::plugin::SupportedPluginExtensions supported_extensions_;
|
||||
|
||||
/**
|
||||
* 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_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user