mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Fully implement the CLAP tail extension
Trivial extension, but this required us to be able to send audio thread callbacks first.
This commit is contained in:
@@ -97,7 +97,8 @@ struct ClapAudioThreadControlRequest {
|
|||||||
using Payload = std::variant<clap::plugin::StartProcessing,
|
using Payload = std::variant<clap::plugin::StartProcessing,
|
||||||
clap::plugin::StopProcessing,
|
clap::plugin::StopProcessing,
|
||||||
clap::plugin::Reset,
|
clap::plugin::Reset,
|
||||||
clap::ext::params::plugin::Flush>;
|
clap::ext::params::plugin::Flush,
|
||||||
|
clap::ext::tail::plugin::Get>;
|
||||||
|
|
||||||
Payload payload;
|
Payload payload;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Yabridge currently tracks CLAP 1.1.1. The implementation status for CLAP's core
|
|||||||
| `clap.posix-fd-support` | :x: Not supported yet |
|
| `clap.posix-fd-support` | :x: Not supported yet |
|
||||||
| `clap.render` | :x: Not supported yet |
|
| `clap.render` | :x: Not supported yet |
|
||||||
| `clap.state` | :x: Not supported yet |
|
| `clap.state` | :x: Not supported yet |
|
||||||
| `clap.tail` | :x: Not supported yet |
|
| `clap.tail` | :heavy_check_mark: |
|
||||||
| `clap.thread-check` | :x: Not supported yet |
|
| `clap.thread-check` | :x: Not supported yet |
|
||||||
| `clap.thread-pool` | :x: Not supported yet |
|
| `clap.thread-pool` | :x: Not supported yet |
|
||||||
| `clap.timer-support` | :x: Not supported yet |
|
| `clap.timer-support` | :x: Not supported yet |
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <clap/ext/audio-ports.h>
|
#include <clap/ext/audio-ports.h>
|
||||||
#include <clap/ext/note-ports.h>
|
#include <clap/ext/note-ports.h>
|
||||||
#include <clap/ext/params.h>
|
#include <clap/ext/params.h>
|
||||||
|
#include <clap/ext/tail.h>
|
||||||
|
|
||||||
namespace clap {
|
namespace clap {
|
||||||
namespace host {
|
namespace host {
|
||||||
@@ -30,11 +31,12 @@ Host::Host(const clap_host_t& original)
|
|||||||
url(original.url ? std::optional(original.url) : std::nullopt),
|
url(original.url ? std::optional(original.url) : std::nullopt),
|
||||||
version((assert(original.version), original.version)) {}
|
version((assert(original.version), original.version)) {}
|
||||||
|
|
||||||
std::array<std::pair<bool, const char*>, 3> SupportedHostExtensions::list()
|
std::array<std::pair<bool, const char*>, 4> SupportedHostExtensions::list()
|
||||||
const noexcept {
|
const noexcept {
|
||||||
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
|
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
|
||||||
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
|
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
|
||||||
std::pair(supports_params, CLAP_EXT_PARAMS)};
|
std::pair(supports_params, CLAP_EXT_PARAMS),
|
||||||
|
std::pair(supports_tail, CLAP_EXT_TAIL)};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace host
|
} // namespace host
|
||||||
|
|||||||
@@ -84,18 +84,20 @@ struct SupportedHostExtensions {
|
|||||||
bool supports_audio_ports = false;
|
bool supports_audio_ports = false;
|
||||||
bool supports_note_ports = false;
|
bool supports_note_ports = false;
|
||||||
bool supports_params = false;
|
bool supports_params = false;
|
||||||
|
bool supports_tail = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of `<bool, extension_name>` tuples for the supported
|
* Get a list of `<bool, extension_name>` tuples for the supported
|
||||||
* extensions. Used during logging.
|
* extensions. Used during logging.
|
||||||
*/
|
*/
|
||||||
std::array<std::pair<bool, const char*>, 3> list() const noexcept;
|
std::array<std::pair<bool, const char*>, 4> list() const noexcept;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
s.value1b(supports_audio_ports);
|
s.value1b(supports_audio_ports);
|
||||||
s.value1b(supports_note_ports);
|
s.value1b(supports_note_ports);
|
||||||
s.value1b(supports_params);
|
s.value1b(supports_params);
|
||||||
|
s.value1b(supports_tail);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <clap/ext/audio-ports.h>
|
#include <clap/ext/audio-ports.h>
|
||||||
#include <clap/ext/note-ports.h>
|
#include <clap/ext/note-ports.h>
|
||||||
#include <clap/ext/params.h>
|
#include <clap/ext/params.h>
|
||||||
|
#include <clap/ext/tail.h>
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@@ -78,11 +79,12 @@ const clap_plugin_descriptor_t* Descriptor::get() const {
|
|||||||
return &clap_descriptor;
|
return &clap_descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<std::pair<bool, const char*>, 3> SupportedPluginExtensions::list()
|
std::array<std::pair<bool, const char*>, 4> SupportedPluginExtensions::list()
|
||||||
const noexcept {
|
const noexcept {
|
||||||
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
|
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
|
||||||
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
|
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
|
||||||
std::pair(supports_params, CLAP_EXT_PARAMS)};
|
std::pair(supports_params, CLAP_EXT_PARAMS),
|
||||||
|
std::pair(supports_tail, CLAP_EXT_TAIL)};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace plugin
|
} // namespace plugin
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ struct SupportedPluginExtensions {
|
|||||||
bool supports_audio_ports = false;
|
bool supports_audio_ports = false;
|
||||||
bool supports_note_ports = false;
|
bool supports_note_ports = false;
|
||||||
bool supports_params = false;
|
bool supports_params = false;
|
||||||
|
bool supports_tail = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of `<bool, extension_name>` tuples for the supported
|
* Get a list of `<bool, extension_name>` tuples for the supported
|
||||||
@@ -129,6 +130,7 @@ struct SupportedPluginExtensions {
|
|||||||
s.value1b(supports_audio_ports);
|
s.value1b(supports_audio_ports);
|
||||||
s.value1b(supports_note_ports);
|
s.value1b(supports_note_ports);
|
||||||
s.value1b(supports_params);
|
s.value1b(supports_params);
|
||||||
|
s.value1b(supports_tail);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ ClapHostExtensions::ClapHostExtensions(const clap_host& host) noexcept
|
|||||||
note_ports(static_cast<const clap_host_note_ports_t*>(
|
note_ports(static_cast<const clap_host_note_ports_t*>(
|
||||||
host.get_extension(&host, CLAP_EXT_NOTE_PORTS))),
|
host.get_extension(&host, CLAP_EXT_NOTE_PORTS))),
|
||||||
params(static_cast<const clap_host_params_t*>(
|
params(static_cast<const clap_host_params_t*>(
|
||||||
host.get_extension(&host, CLAP_EXT_PARAMS))) {}
|
host.get_extension(&host, CLAP_EXT_PARAMS))),
|
||||||
|
tail(static_cast<const clap_host_tail_t*>(
|
||||||
|
host.get_extension(&host, CLAP_EXT_TAIL))) {}
|
||||||
|
|
||||||
ClapHostExtensions::ClapHostExtensions() noexcept {}
|
ClapHostExtensions::ClapHostExtensions() noexcept {}
|
||||||
|
|
||||||
@@ -33,7 +35,8 @@ clap::host::SupportedHostExtensions ClapHostExtensions::supported()
|
|||||||
return clap::host::SupportedHostExtensions{
|
return clap::host::SupportedHostExtensions{
|
||||||
.supports_audio_ports = audio_ports != nullptr,
|
.supports_audio_ports = audio_ports != nullptr,
|
||||||
.supports_note_ports = note_ports != nullptr,
|
.supports_note_ports = note_ports != nullptr,
|
||||||
.supports_params = params != nullptr};
|
.supports_params = params != nullptr,
|
||||||
|
.supports_tail = tail != nullptr};
|
||||||
}
|
}
|
||||||
|
|
||||||
clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
|
clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
|
||||||
@@ -74,6 +77,9 @@ clap_plugin_proxy::clap_plugin_proxy(ClapPluginBridge& bridge,
|
|||||||
.text_to_value = ext_params_text_to_value,
|
.text_to_value = ext_params_text_to_value,
|
||||||
.flush = ext_params_flush,
|
.flush = ext_params_flush,
|
||||||
}),
|
}),
|
||||||
|
ext_tail_vtable(clap_plugin_tail_t{
|
||||||
|
.get = ext_tail_get,
|
||||||
|
}),
|
||||||
// These function objects are relatively large, and we probably won't be
|
// These function objects are relatively large, and we probably won't be
|
||||||
// getting that many of them
|
// getting that many of them
|
||||||
pending_callbacks_(128) {}
|
pending_callbacks_(128) {}
|
||||||
@@ -210,6 +216,9 @@ clap_plugin_proxy::plugin_get_extension(const struct clap_plugin* plugin,
|
|||||||
} else if (self->supported_extensions_.supports_params &&
|
} else if (self->supported_extensions_.supports_params &&
|
||||||
strcmp(id, CLAP_EXT_PARAMS) == 0) {
|
strcmp(id, CLAP_EXT_PARAMS) == 0) {
|
||||||
extension_ptr = &self->ext_params_vtable;
|
extension_ptr = &self->ext_params_vtable;
|
||||||
|
} else if (self->supported_extensions_.supports_tail &&
|
||||||
|
strcmp(id, CLAP_EXT_TAIL) == 0) {
|
||||||
|
extension_ptr = &self->ext_tail_vtable;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->bridge_.logger_.log_extension_query("clap_plugin::get_extension",
|
self->bridge_.logger_.log_extension_query("clap_plugin::get_extension",
|
||||||
@@ -408,3 +417,11 @@ clap_plugin_proxy::ext_params_flush(const clap_plugin_t* plugin,
|
|||||||
self->bridge_.send_audio_thread_message(
|
self->bridge_.send_audio_thread_message(
|
||||||
clap::ext::params::plugin::Flush{.instance_id = self->instance_id()});
|
clap::ext::params::plugin::Flush{.instance_id = self->instance_id()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t CLAP_ABI clap_plugin_proxy::ext_tail_get(const clap_plugin_t* plugin) {
|
||||||
|
assert(plugin && plugin->plugin_data);
|
||||||
|
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
||||||
|
|
||||||
|
return self->bridge_.send_audio_thread_message(
|
||||||
|
clap::ext::tail::plugin::Get{.instance_id = self->instance_id()});
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <clap/ext/audio-ports.h>
|
#include <clap/ext/audio-ports.h>
|
||||||
#include <clap/ext/note-ports.h>
|
#include <clap/ext/note-ports.h>
|
||||||
#include <clap/ext/params.h>
|
#include <clap/ext/params.h>
|
||||||
|
#include <clap/ext/tail.h>
|
||||||
#include <clap/plugin.h>
|
#include <clap/plugin.h>
|
||||||
#include <rigtorp/MPMCQueue.h>
|
#include <rigtorp/MPMCQueue.h>
|
||||||
#include <function2/function2.hpp>
|
#include <function2/function2.hpp>
|
||||||
@@ -61,6 +62,7 @@ struct ClapHostExtensions {
|
|||||||
const clap_host_audio_ports_t* audio_ports = nullptr;
|
const clap_host_audio_ports_t* audio_ports = nullptr;
|
||||||
const clap_host_note_ports_t* note_ports = nullptr;
|
const clap_host_note_ports_t* note_ports = nullptr;
|
||||||
const clap_host_params_t* params = nullptr;
|
const clap_host_params_t* params = nullptr;
|
||||||
|
const clap_host_tail_t* tail = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,6 +164,8 @@ class clap_plugin_proxy {
|
|||||||
const clap_input_events_t* in,
|
const clap_input_events_t* in,
|
||||||
const clap_output_events_t* out);
|
const clap_output_events_t* out);
|
||||||
|
|
||||||
|
static uint32_t CLAP_ABI ext_tail_get(const clap_plugin_t* plugin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronously run a function on the host's main thread, returning the
|
* Asynchronously run a function on the host's main thread, returning the
|
||||||
* result as a future.
|
* result as a future.
|
||||||
@@ -235,9 +239,10 @@ class clap_plugin_proxy {
|
|||||||
// Extensions also have vtables. Whether or not we expose these to the host
|
// Extensions also have vtables. Whether or not we expose these to the host
|
||||||
// depends on whether the plugin supported this extension when we called
|
// depends on whether the plugin supported this extension when we called
|
||||||
// `clap_plugin::init()`.
|
// `clap_plugin::init()`.
|
||||||
const clap_plugin_audio_ports ext_audio_ports_vtable;
|
const clap_plugin_audio_ports_t ext_audio_ports_vtable;
|
||||||
const clap_plugin_note_ports ext_note_ports_vtable;
|
const clap_plugin_note_ports_t ext_note_ports_vtable;
|
||||||
const clap_plugin_params ext_params_vtable;
|
const clap_plugin_params_t ext_params_vtable;
|
||||||
|
const clap_plugin_tail_t ext_tail_vtable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The extensions supported by the bridged plugin. Set after a successful
|
* The extensions supported by the bridged plugin. Set after a successful
|
||||||
|
|||||||
@@ -278,12 +278,13 @@ void ClapPluginBridge::register_plugin_proxy(
|
|||||||
},
|
},
|
||||||
[&](const clap::ext::tail::host::Changed& request)
|
[&](const clap::ext::tail::host::Changed& request)
|
||||||
-> clap::ext::tail::host::Changed::Response {
|
-> clap::ext::tail::host::Changed::Response {
|
||||||
// FIXME:
|
const auto& [plugin_proxy, _] =
|
||||||
// const auto& [instance, _] =
|
get_proxy(request.owner_instance_id);
|
||||||
// get_instance(request.instance_id);
|
|
||||||
|
|
||||||
// return instance.plugin->start_processing(
|
plugin_proxy.host_extensions_.tail->changed(
|
||||||
// instance.plugin.get());
|
plugin_proxy.host_);
|
||||||
|
|
||||||
|
return Ack{};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ clap_host_proxy::clap_host_proxy(ClapBridge& bridge,
|
|||||||
.rescan = ext_params_rescan,
|
.rescan = ext_params_rescan,
|
||||||
.clear = ext_params_clear,
|
.clear = ext_params_clear,
|
||||||
.request_flush = ext_params_request_flush,
|
.request_flush = ext_params_request_flush,
|
||||||
|
}),
|
||||||
|
ext_tail_vtable(clap_host_tail_t{
|
||||||
|
.changed = ext_tail_changed,
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
const void* CLAP_ABI
|
const void* CLAP_ABI
|
||||||
@@ -74,6 +77,9 @@ clap_host_proxy::host_get_extension(const struct clap_host* host,
|
|||||||
} else if (self->supported_extensions_.supports_params &&
|
} else if (self->supported_extensions_.supports_params &&
|
||||||
strcmp(extension_id, CLAP_EXT_PARAMS) == 0) {
|
strcmp(extension_id, CLAP_EXT_PARAMS) == 0) {
|
||||||
extension_ptr = &self->ext_params_vtable;
|
extension_ptr = &self->ext_params_vtable;
|
||||||
|
} else if (self->supported_extensions_.supports_tail &&
|
||||||
|
strcmp(extension_id, CLAP_EXT_TAIL) == 0) {
|
||||||
|
extension_ptr = &self->ext_tail_vtable;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->bridge_.logger_.log_extension_query("clap_host::get_extension",
|
self->bridge_.logger_.log_extension_query("clap_host::get_extension",
|
||||||
@@ -135,7 +141,7 @@ bool CLAP_ABI clap_host_proxy::ext_audio_ports_is_rescan_flag_supported(
|
|||||||
const clap_host_t* host,
|
const clap_host_t* host,
|
||||||
uint32_t flag) {
|
uint32_t flag) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
return self->bridge_.send_main_thread_message(
|
return self->bridge_.send_main_thread_message(
|
||||||
clap::ext::audio_ports::host::IsRescanFlagSupported{
|
clap::ext::audio_ports::host::IsRescanFlagSupported{
|
||||||
@@ -145,7 +151,7 @@ bool CLAP_ABI clap_host_proxy::ext_audio_ports_is_rescan_flag_supported(
|
|||||||
void CLAP_ABI clap_host_proxy::ext_audio_ports_rescan(const clap_host_t* host,
|
void CLAP_ABI clap_host_proxy::ext_audio_ports_rescan(const clap_host_t* host,
|
||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
self->bridge_.send_main_thread_message(clap::ext::audio_ports::host::Rescan{
|
self->bridge_.send_main_thread_message(clap::ext::audio_ports::host::Rescan{
|
||||||
.owner_instance_id = self->owner_instance_id(), .flags = flags});
|
.owner_instance_id = self->owner_instance_id(), .flags = flags});
|
||||||
@@ -154,7 +160,7 @@ void CLAP_ABI clap_host_proxy::ext_audio_ports_rescan(const clap_host_t* host,
|
|||||||
uint32_t CLAP_ABI
|
uint32_t CLAP_ABI
|
||||||
clap_host_proxy::ext_note_ports_supported_dialects(const clap_host_t* host) {
|
clap_host_proxy::ext_note_ports_supported_dialects(const clap_host_t* host) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
return self->bridge_.send_main_thread_message(
|
return self->bridge_.send_main_thread_message(
|
||||||
clap::ext::note_ports::host::SupportedDialects{
|
clap::ext::note_ports::host::SupportedDialects{
|
||||||
@@ -164,7 +170,7 @@ clap_host_proxy::ext_note_ports_supported_dialects(const clap_host_t* host) {
|
|||||||
void CLAP_ABI clap_host_proxy::ext_note_ports_rescan(const clap_host_t* host,
|
void CLAP_ABI clap_host_proxy::ext_note_ports_rescan(const clap_host_t* host,
|
||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
self->bridge_.send_main_thread_message(clap::ext::note_ports::host::Rescan{
|
self->bridge_.send_main_thread_message(clap::ext::note_ports::host::Rescan{
|
||||||
.owner_instance_id = self->owner_instance_id(), .flags = flags});
|
.owner_instance_id = self->owner_instance_id(), .flags = flags});
|
||||||
@@ -174,7 +180,7 @@ void CLAP_ABI
|
|||||||
clap_host_proxy::ext_params_rescan(const clap_host_t* host,
|
clap_host_proxy::ext_params_rescan(const clap_host_t* host,
|
||||||
clap_param_rescan_flags flags) {
|
clap_param_rescan_flags flags) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
self->bridge_.send_main_thread_message(clap::ext::params::host::Rescan{
|
self->bridge_.send_main_thread_message(clap::ext::params::host::Rescan{
|
||||||
.owner_instance_id = self->owner_instance_id(), .flags = flags});
|
.owner_instance_id = self->owner_instance_id(), .flags = flags});
|
||||||
@@ -184,7 +190,7 @@ void CLAP_ABI clap_host_proxy::ext_params_clear(const clap_host_t* host,
|
|||||||
clap_id param_id,
|
clap_id param_id,
|
||||||
clap_param_clear_flags flags) {
|
clap_param_clear_flags flags) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
self->bridge_.send_main_thread_message(clap::ext::params::host::Clear{
|
self->bridge_.send_main_thread_message(clap::ext::params::host::Clear{
|
||||||
.owner_instance_id = self->owner_instance_id(),
|
.owner_instance_id = self->owner_instance_id(),
|
||||||
@@ -195,9 +201,17 @@ void CLAP_ABI clap_host_proxy::ext_params_clear(const clap_host_t* host,
|
|||||||
void CLAP_ABI
|
void CLAP_ABI
|
||||||
clap_host_proxy::ext_params_request_flush(const clap_host_t* host) {
|
clap_host_proxy::ext_params_request_flush(const clap_host_t* host) {
|
||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
self->bridge_.send_audio_thread_message(
|
self->bridge_.send_audio_thread_message(
|
||||||
clap::ext::params::host::RequestFlush{.owner_instance_id =
|
clap::ext::params::host::RequestFlush{.owner_instance_id =
|
||||||
self->owner_instance_id()});
|
self->owner_instance_id()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLAP_ABI clap_host_proxy::ext_tail_changed(const clap_host_t* host) {
|
||||||
|
assert(host && host->host_data);
|
||||||
|
auto self = static_cast<const clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
|
self->bridge_.send_audio_thread_message(clap::ext::tail::host::Changed{
|
||||||
|
.owner_instance_id = self->owner_instance_id()});
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <clap/ext/audio-ports.h>
|
#include <clap/ext/audio-ports.h>
|
||||||
#include <clap/ext/note-ports.h>
|
#include <clap/ext/note-ports.h>
|
||||||
#include <clap/ext/params.h>
|
#include <clap/ext/params.h>
|
||||||
|
#include <clap/ext/tail.h>
|
||||||
#include <clap/host.h>
|
#include <clap/host.h>
|
||||||
|
|
||||||
#include "../../common/serialization/clap/plugin-factory.h"
|
#include "../../common/serialization/clap/plugin-factory.h"
|
||||||
@@ -83,6 +84,8 @@ class clap_host_proxy {
|
|||||||
clap_param_clear_flags flags);
|
clap_param_clear_flags flags);
|
||||||
static void CLAP_ABI ext_params_request_flush(const clap_host_t* host);
|
static void CLAP_ABI ext_params_request_flush(const clap_host_t* host);
|
||||||
|
|
||||||
|
static void CLAP_ABI ext_tail_changed(const clap_host_t* host);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The extensions supported by the host, set just before calling
|
* The extensions supported by the host, set just before calling
|
||||||
* `clap_plugin::init()` on the bridged plugin. We'll allow the plugin to
|
* `clap_plugin::init()` on the bridged plugin. We'll allow the plugin to
|
||||||
@@ -105,9 +108,10 @@ class clap_host_proxy {
|
|||||||
// Extensions also have vtables. Whether or not we expose these to the host
|
// Extensions also have vtables. Whether or not we expose these to the host
|
||||||
// depends on whether the plugin supported this extension when the host
|
// depends on whether the plugin supported this extension when the host
|
||||||
// called `clap_plugin::init()`.
|
// called `clap_plugin::init()`.
|
||||||
const clap_host_audio_ports ext_audio_ports_vtable;
|
const clap_host_audio_ports_t ext_audio_ports_vtable;
|
||||||
const clap_host_note_ports ext_note_ports_vtable;
|
const clap_host_note_ports_t ext_note_ports_vtable;
|
||||||
const clap_host_params ext_params_vtable;
|
const clap_host_params_t ext_params_vtable;
|
||||||
|
const clap_host_tail_t ext_tail_vtable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of whether there are pending host callbacks. Used to prevent
|
* Keeps track of whether there are pending host callbacks. Used to prevent
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ ClapPluginExtensions::ClapPluginExtensions(const clap_plugin& plugin) noexcept
|
|||||||
note_ports(static_cast<const clap_plugin_note_ports_t*>(
|
note_ports(static_cast<const clap_plugin_note_ports_t*>(
|
||||||
plugin.get_extension(&plugin, CLAP_EXT_NOTE_PORTS))),
|
plugin.get_extension(&plugin, CLAP_EXT_NOTE_PORTS))),
|
||||||
params(static_cast<const clap_plugin_params_t*>(
|
params(static_cast<const clap_plugin_params_t*>(
|
||||||
plugin.get_extension(&plugin, CLAP_EXT_PARAMS))) {}
|
plugin.get_extension(&plugin, CLAP_EXT_PARAMS))),
|
||||||
|
tail(static_cast<const clap_plugin_tail_t*>(
|
||||||
|
plugin.get_extension(&plugin, CLAP_EXT_TAIL))) {}
|
||||||
|
|
||||||
ClapPluginExtensions::ClapPluginExtensions() noexcept {}
|
ClapPluginExtensions::ClapPluginExtensions() noexcept {}
|
||||||
|
|
||||||
@@ -41,7 +43,8 @@ clap::plugin::SupportedPluginExtensions ClapPluginExtensions::supported()
|
|||||||
return clap::plugin::SupportedPluginExtensions{
|
return clap::plugin::SupportedPluginExtensions{
|
||||||
.supports_audio_ports = audio_ports != nullptr,
|
.supports_audio_ports = audio_ports != nullptr,
|
||||||
.supports_note_ports = note_ports != nullptr,
|
.supports_note_ports = note_ports != nullptr,
|
||||||
.supports_params = params != nullptr};
|
.supports_params = params != nullptr,
|
||||||
|
.supports_tail = tail != nullptr};
|
||||||
}
|
}
|
||||||
|
|
||||||
ClapPluginInstance::ClapPluginInstance(
|
ClapPluginInstance::ClapPluginInstance(
|
||||||
@@ -660,6 +663,14 @@ void ClapBridge::register_plugin_instance(
|
|||||||
|
|
||||||
return clap::ext::params::plugin::FlushResponse{};
|
return clap::ext::params::plugin::FlushResponse{};
|
||||||
},
|
},
|
||||||
|
[&](const clap::ext::tail::plugin::Get& request)
|
||||||
|
-> clap::ext::tail::plugin::Get::Response {
|
||||||
|
const auto& [instance, _] =
|
||||||
|
get_instance(request.instance_id);
|
||||||
|
|
||||||
|
return instance.extensions.tail->get(
|
||||||
|
instance.plugin.get());
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ struct ClapPluginExtensions {
|
|||||||
const clap_plugin_audio_ports_t* audio_ports = nullptr;
|
const clap_plugin_audio_ports_t* audio_ports = nullptr;
|
||||||
const clap_plugin_note_ports_t* note_ports = nullptr;
|
const clap_plugin_note_ports_t* note_ports = nullptr;
|
||||||
const clap_plugin_params_t* params = nullptr;
|
const clap_plugin_params_t* params = nullptr;
|
||||||
|
const clap_plugin_tail_t* tail = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user