mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Fully implement the params flush function
Now the params extension is finally fully implemented, and a lot of the unused variable compiler warnings are gone.
This commit is contained in:
@@ -653,13 +653,23 @@ void CLAP_ABI
|
||||
clap_plugin_proxy::ext_params_flush(const clap_plugin_t* plugin,
|
||||
const clap_input_events_t* in,
|
||||
const clap_output_events_t* out) {
|
||||
assert(plugin && plugin->plugin_data);
|
||||
assert(plugin && plugin->plugin_data && in && out);
|
||||
auto self = static_cast<const clap_plugin_proxy*>(plugin->plugin_data);
|
||||
|
||||
// This will not allocate below 64 events. Since flush will primarily be
|
||||
// called on the main thread, we don't really care about minimizing
|
||||
// allocations beyond that point here.
|
||||
clap::events::EventList events{};
|
||||
events.repopulate(*in);
|
||||
|
||||
// This may also be called on the audio thread and it is never called during
|
||||
// process, so always using the audio thread here is safe
|
||||
self->bridge_.send_audio_thread_message(
|
||||
clap::ext::params::plugin::Flush{.instance_id = self->instance_id()});
|
||||
const clap::ext::params::plugin::FlushResponse response =
|
||||
self->bridge_.send_audio_thread_message(
|
||||
clap::ext::params::plugin::Flush{.instance_id = self->instance_id(),
|
||||
.in = std::move(events)});
|
||||
|
||||
response.out.write_back_outputs(*out);
|
||||
}
|
||||
|
||||
bool CLAP_ABI clap_plugin_proxy::ext_state_save(const clap_plugin_t* plugin,
|
||||
|
||||
@@ -941,16 +941,18 @@ void ClapBridge::register_plugin_instance(
|
||||
|
||||
return Ack{};
|
||||
},
|
||||
[&](const clap::ext::params::plugin::Flush& request)
|
||||
[&](clap::ext::params::plugin::Flush& request)
|
||||
-> clap::ext::params::plugin::Flush::Response {
|
||||
const auto& [instance, _] =
|
||||
get_instance(request.instance_id);
|
||||
|
||||
// TODO: Implement this
|
||||
// instance.extensions.params->flush(instance.plugin.get(),
|
||||
// in, out);
|
||||
clap::events::EventList out{};
|
||||
instance.extensions.params->flush(
|
||||
instance.plugin.get(), request.in.input_events(),
|
||||
out.output_events());
|
||||
|
||||
return clap::ext::params::plugin::FlushResponse{};
|
||||
return clap::ext::params::plugin::FlushResponse{
|
||||
.out = std::move(out)};
|
||||
},
|
||||
[&](const clap::ext::tail::plugin::Get& request)
|
||||
-> clap::ext::tail::plugin::Get::Response {
|
||||
|
||||
Reference in New Issue
Block a user