Fully implement the audio ports extension

This commit is contained in:
Robbert van der Helm
2022-09-12 20:11:34 +02:00
parent 31fdf9c3d8
commit bb3bc49c60
5 changed files with 76 additions and 7 deletions
@@ -118,8 +118,9 @@ bool CLAP_ABI clap_host_proxy::ext_audio_ports_is_rescan_flag_supported(
assert(host && host->host_data);
auto self = static_cast<clap_host_proxy*>(host->host_data);
// TODO: Implement
return false;
return self->bridge_.send_main_thread_message(
clap::ext::audio_ports::host::IsRescanFlagSupported{
.owner_instance_id = self->owner_instance_id(), .flag = flag});
}
void CLAP_ABI clap_host_proxy::ext_audio_ports_rescan(const clap_host_t* host,
@@ -127,5 +128,6 @@ void CLAP_ABI clap_host_proxy::ext_audio_ports_rescan(const clap_host_t* host,
assert(host && host->host_data);
auto self = static_cast<clap_host_proxy*>(host->host_data);
// TODO: Implement
self->bridge_.send_main_thread_message(clap::ext::audio_ports::host::Rescan{
.owner_instance_id = self->owner_instance_id(), .flags = flags});
}
+24
View File
@@ -310,6 +310,30 @@ void ClapBridge::run() {
})
.get();
},
[&](const clap::ext::audio_ports::plugin::Count& request)
-> clap::ext::audio_ports::plugin::Count::Response {
const auto& [instance, _] = get_instance(request.instance_id);
// We'll ignore the main thread requirement for simple lookup
// functions like this for performance's sake
return instance.extensions.audio_ports->count(
instance.plugin.get(), request.is_input);
},
[&](const clap::ext::audio_ports::plugin::Get& request)
-> clap::ext::audio_ports::plugin::Get::Response {
const auto& [instance, _] = get_instance(request.instance_id);
clap_audio_port_info_t info{};
if (instance.extensions.audio_ports->get(
instance.plugin.get(), request.index, request.is_input,
&info)) {
return clap::ext::audio_ports::plugin::GetResponse{
.result = info};
} else {
return clap::ext::audio_ports::plugin::GetResponse{
.result = std::nullopt};
}
},
});
}