mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Fully implement the audio ports extension
This commit is contained in:
@@ -201,8 +201,9 @@ clap_plugin_proxy::ext_audio_ports_count(const clap_plugin_t* plugin,
|
||||
assert(plugin && plugin->plugin_data);
|
||||
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
||||
|
||||
// TODO: Implement
|
||||
return 0;
|
||||
return self->bridge_.send_main_thread_message(
|
||||
clap::ext::audio_ports::plugin::Count{
|
||||
.instance_id = self->instance_id(), .is_input = is_input});
|
||||
}
|
||||
|
||||
bool CLAP_ABI
|
||||
@@ -213,6 +214,17 @@ clap_plugin_proxy::ext_audio_ports_get(const clap_plugin_t* plugin,
|
||||
assert(plugin && plugin->plugin_data && info);
|
||||
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
||||
|
||||
// TODO: Implement
|
||||
return false;
|
||||
const clap::ext::audio_ports::plugin::GetResponse response =
|
||||
self->bridge_.send_main_thread_message(
|
||||
clap::ext::audio_ports::plugin::Get{
|
||||
.instance_id = self->instance_id(),
|
||||
.index = index,
|
||||
.is_input = is_input});
|
||||
if (response.result) {
|
||||
response.result->reconstruct(*info);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,36 @@ ClapPluginBridge::ClapPluginBridge(const ghc::filesystem::path& plugin_path)
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](const clap::ext::audio_ports::host::IsRescanFlagSupported&
|
||||
request)
|
||||
-> clap::ext::audio_ports::host::IsRescanFlagSupported::
|
||||
Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
// We'll ignore the main thread requirement for
|
||||
// simple lookup functions like this for
|
||||
// performance's sake
|
||||
return plugin_proxy.extensions_.audio_ports
|
||||
->is_rescan_flag_supported(plugin_proxy.host_,
|
||||
request.flag);
|
||||
},
|
||||
[&](const clap::ext::audio_ports::host::Rescan& request)
|
||||
-> clap::ext::audio_ports::host::Rescan::Response {
|
||||
const auto& [plugin_proxy, _] =
|
||||
get_proxy(request.owner_instance_id);
|
||||
|
||||
plugin_proxy
|
||||
.run_on_main_thread(
|
||||
[&, host = plugin_proxy.host_,
|
||||
audio_ports =
|
||||
plugin_proxy.extensions_.audio_ports]() {
|
||||
audio_ports->rescan(host, request.flags);
|
||||
})
|
||||
.wait();
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ if with_clap
|
||||
'../common/notifications.cpp',
|
||||
'../common/plugins.cpp',
|
||||
'../common/process.cpp',
|
||||
'../common/serialization/clap/ext/audio-ports.cpp',
|
||||
'../common/serialization/clap/host.cpp',
|
||||
'../common/serialization/clap/plugin.cpp',
|
||||
'../common/utils.cpp',
|
||||
|
||||
Reference in New Issue
Block a user