Implement host side of the note-name extension

This commit is contained in:
Robbert van der Helm
2022-10-21 17:11:28 +02:00
parent b360831c5f
commit e2ec0e286f
8 changed files with 47 additions and 2 deletions
@@ -69,6 +69,9 @@ clap_host_proxy::clap_host_proxy(ClapBridge& bridge,
ext_log_vtable(clap_host_log_t{
.log = ext_log_log,
}),
ext_note_name_vtable(clap_host_note_name_t{
.changed = ext_note_name_changed,
}),
ext_note_ports_vtable(clap_host_note_ports_t{
.supported_dialects = ext_note_ports_supported_dialects,
.rescan = ext_note_ports_rescan,
@@ -116,6 +119,9 @@ clap_host_proxy::host_get_extension(const struct clap_host* host,
// supports it, or we'll print the message if it doesn't. That allows us
// to filter misbehavior messages.
extension_ptr = &self->ext_log_vtable;
} else if (self->supported_extensions_.supports_note_name &&
strcmp(extension_id, CLAP_EXT_NOTE_NAME) == 0) {
extension_ptr = &self->ext_note_name_vtable;
} else if (self->supported_extensions_.supports_note_ports &&
strcmp(extension_id, CLAP_EXT_NOTE_PORTS) == 0) {
extension_ptr = &self->ext_note_ports_vtable;
@@ -363,6 +369,15 @@ void CLAP_ABI clap_host_proxy::ext_log_log(const clap_host_t* host,
}
}
void CLAP_ABI clap_host_proxy::ext_note_name_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_mutually_recursive_main_thread_message(
clap::ext::note_name::host::Changed{.owner_instance_id =
self->owner_instance_id()});
}
uint32_t CLAP_ABI
clap_host_proxy::ext_note_ports_supported_dialects(const clap_host_t* host) {
assert(host && host->host_data);
@@ -23,6 +23,7 @@
#include <clap/ext/gui.h>
#include <clap/ext/latency.h>
#include <clap/ext/log.h>
#include <clap/ext/note-name.h>
#include <clap/ext/note-ports.h>
#include <clap/ext/params.h>
#include <clap/ext/state.h>
@@ -104,6 +105,8 @@ class clap_host_proxy {
clap_log_severity severity,
const char* msg);
static void CLAP_ABI ext_note_name_changed(const clap_host_t* host);
static uint32_t CLAP_ABI
ext_note_ports_supported_dialects(const clap_host_t* host);
static void CLAP_ABI ext_note_ports_rescan(const clap_host_t* host,
@@ -150,6 +153,7 @@ class clap_host_proxy {
// can filter out plugin/host misbehavior messages on lower yabridge
// verbosity levels.
const clap_host_log_t ext_log_vtable;
const clap_host_note_name_t ext_note_name_vtable;
const clap_host_note_ports_t ext_note_ports_vtable;
const clap_host_params_t ext_params_vtable;
const clap_host_state_t ext_state_vtable;