Add stubs for host side audio ports extension

This commit is contained in:
Robbert van der Helm
2022-09-12 17:09:01 +02:00
parent e39a43c38c
commit fa47274dd4
2 changed files with 43 additions and 2 deletions
@@ -43,13 +43,24 @@ clap_host_proxy::clap_host_proxy(ClapBridge& bridge,
.request_restart = host_request_restart,
.request_process = host_request_process,
.request_callback = host_request_callback,
}),
ext_audio_ports_vtable(clap_host_audio_ports_t{
.is_rescan_flag_supported = ext_audio_ports_is_rescan_flag_supported,
.rescan = ext_audio_ports_rescan,
}) {}
const void* CLAP_ABI
clap_host_proxy::host_get_extension(const struct clap_host* host,
const char* extension_id) {
// TODO: Implement
return nullptr;
assert(host && host->host_data && extension_id);
auto self = static_cast<const clap_host_proxy*>(host->host_data);
if (self->supported_extensions_.supports_audio_ports &&
strcmp(extension_id, CLAP_EXT_AUDIO_PORTS) == 0) {
return &self->ext_audio_ports_vtable;
} else {
return nullptr;
}
}
void CLAP_ABI
@@ -100,3 +111,21 @@ clap_host_proxy::host_request_callback(const struct clap_host* host) {
});
}
}
bool CLAP_ABI clap_host_proxy::ext_audio_ports_is_rescan_flag_supported(
const clap_host_t* host,
uint32_t flag) {
assert(host && host->host_data);
auto self = static_cast<clap_host_proxy*>(host->host_data);
// TODO: Implement
return false;
}
void CLAP_ABI clap_host_proxy::ext_audio_ports_rescan(const clap_host_t* host,
uint32_t flags) {
assert(host && host->host_data);
auto self = static_cast<clap_host_proxy*>(host->host_data);
// TODO: Implement
}
@@ -18,6 +18,7 @@
#include <atomic>
#include <clap/ext/audio-ports.h>
#include <clap/host.h>
#include "../../common/serialization/clap/plugin-factory.h"
@@ -62,6 +63,12 @@ class clap_host_proxy {
static void CLAP_ABI host_request_process(const struct clap_host* host);
static void CLAP_ABI host_request_callback(const struct clap_host* host);
static bool CLAP_ABI
ext_audio_ports_is_rescan_flag_supported(const clap_host_t* host,
uint32_t flag);
static void CLAP_ABI ext_audio_ports_rescan(const clap_host_t* host,
uint32_t flags);
/**
* The extensions supported by the host, set just before calling
* `clap_plugin::init()` on the bridged plugin. We'll allow the plugin to
@@ -81,6 +88,11 @@ class clap_host_proxy {
*/
const clap_host_t host_vtable_;
// Extensions also have vtables. Whether or not we expose these to the host
// depends on whether the plugin supported this extension when the host
// called `clap_plugin::init()`.
const clap_host_audio_ports ext_audio_ports_vtable;
/**
* Keeps track of whether there are pending host callbacks. Used to prevent
* calling `clap_plugin::on_main_thread()` multiple times in a row when the