mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-13 20:09:59 +02:00
Deduplicate CLAP extension support queries
They're only queried once now and the booleans are derived from the stored pointers.
This commit is contained in:
@@ -28,8 +28,5 @@ Host::Host(const clap_host_t& original)
|
||||
url(original.url ? std::optional(original.url) : std::nullopt),
|
||||
version((assert(original.version), original.version)) {}
|
||||
|
||||
SupportedHostExtensions::SupportedHostExtensions(const clap_host& host)
|
||||
: supports_audio_ports(host.get_extension(&host, CLAP_EXT_AUDIO_PORTS)) {}
|
||||
|
||||
} // namespace host
|
||||
} // namespace clap
|
||||
|
||||
@@ -75,18 +75,11 @@ struct Host {
|
||||
|
||||
/**
|
||||
* Extensions supported by the host. This can only be queried in
|
||||
* `clap_plugin::init()` so it cannot be part of `Host`. We'll create make these
|
||||
* same extensions available to the bridged CLAP plugins using proxies.
|
||||
* `clap_plugin::init()` so it cannot be part of `Host`. Created by
|
||||
* `ClapHostExtensions::supported()`. We'll create make these same extensions
|
||||
* available to the bridged CLAP plugins using proxies.
|
||||
*/
|
||||
struct SupportedHostExtensions {
|
||||
/**
|
||||
* Read the supported extensions from a native CLAP host. This is only valid
|
||||
* once the native host has called `clap_host::init()`.
|
||||
*/
|
||||
SupportedHostExtensions(const clap_host& host);
|
||||
|
||||
SupportedHostExtensions() noexcept {}
|
||||
|
||||
// Don't forget to add new extensions to the log output
|
||||
bool supports_audio_ports = false;
|
||||
|
||||
|
||||
@@ -76,9 +76,5 @@ const clap_plugin_descriptor_t* Descriptor::get() const {
|
||||
return &clap_descriptor;
|
||||
}
|
||||
|
||||
SupportedPluginExtensions::SupportedPluginExtensions(const clap_plugin& plugin)
|
||||
: supports_audio_ports(
|
||||
plugin.get_extension(&plugin, CLAP_EXT_AUDIO_PORTS)) {}
|
||||
|
||||
} // namespace plugin
|
||||
} // namespace clap
|
||||
|
||||
@@ -109,17 +109,10 @@ struct Descriptor {
|
||||
};
|
||||
|
||||
/**
|
||||
* Extensions supported by the plugin. Queried after `clap_plugin::init()`.
|
||||
* Extensions supported by the plugin. Queried after `clap_plugin::init()` and
|
||||
* created by `ClapPluginExtensions::supported()`.
|
||||
*/
|
||||
struct SupportedPluginExtensions {
|
||||
/**
|
||||
* Read the supported extensions from a CLAP plugin. This is only valid
|
||||
* after `clap_plugin::init()` has been called on the plugin.
|
||||
*/
|
||||
SupportedPluginExtensions(const clap_plugin& plugin);
|
||||
|
||||
SupportedPluginExtensions() noexcept {}
|
||||
|
||||
// Don't forget to add new extensions to the log output
|
||||
bool supports_audio_ports = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user