mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Move the flush request to the audio thread
This commit is contained in:
@@ -151,11 +151,7 @@ using ClapMainThreadCallbackRequest =
|
|||||||
clap::ext::note_ports::host::SupportedDialects,
|
clap::ext::note_ports::host::SupportedDialects,
|
||||||
clap::ext::note_ports::host::Rescan,
|
clap::ext::note_ports::host::Rescan,
|
||||||
clap::ext::params::host::Rescan,
|
clap::ext::params::host::Rescan,
|
||||||
clap::ext::params::host::Clear,
|
clap::ext::params::host::Clear>;
|
||||||
// This doesn't need to be done on the main thread, but we
|
|
||||||
// don't have an alternative per-plugin instance socket
|
|
||||||
// available so this is probably fine
|
|
||||||
clap::ext::params::host::RequestFlush>;
|
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s, ClapMainThreadCallbackRequest& payload) {
|
void serialize(S& s, ClapMainThreadCallbackRequest& payload) {
|
||||||
@@ -177,7 +173,9 @@ void serialize(S& s, ClapMainThreadCallbackRequest& payload) {
|
|||||||
* used.
|
* used.
|
||||||
*/
|
*/
|
||||||
using ClapAudioThreadCallbackRequest =
|
using ClapAudioThreadCallbackRequest =
|
||||||
std::variant<WantsConfiguration, clap::ext::tail::host::Changed>;
|
std::variant<WantsConfiguration,
|
||||||
|
clap::ext::params::host::RequestFlush,
|
||||||
|
clap::ext::tail::host::Changed>;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s, ClapAudioThreadCallbackRequest& payload) {
|
void serialize(S& s, ClapAudioThreadCallbackRequest& payload) {
|
||||||
|
|||||||
@@ -223,8 +223,6 @@ struct FlushResponse {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: This can be either a main thread or an audio thread function call
|
|
||||||
// depending on whether or not the plugin is active
|
|
||||||
/**
|
/**
|
||||||
* Message struct for `clap_plugin_params::flush()`.
|
* Message struct for `clap_plugin_params::flush()`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
-11
@@ -179,17 +179,6 @@ ClapPluginBridge::ClapPluginBridge(const ghc::filesystem::path& plugin_path)
|
|||||||
|
|
||||||
return Ack{};
|
return Ack{};
|
||||||
},
|
},
|
||||||
[&](const clap::ext::params::host::RequestFlush& request)
|
|
||||||
-> clap::ext::params::host::RequestFlush::Response {
|
|
||||||
const auto& [plugin_proxy, _] =
|
|
||||||
get_proxy(request.owner_instance_id);
|
|
||||||
|
|
||||||
// This doesn't need to be called from the main thread
|
|
||||||
plugin_proxy.host_extensions_.params->request_flush(
|
|
||||||
plugin_proxy.host_);
|
|
||||||
|
|
||||||
return Ack{};
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -277,6 +266,16 @@ void ClapPluginBridge::register_plugin_proxy(
|
|||||||
// hell. I haven't been able to figure out why.
|
// hell. I haven't been able to figure out why.
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
[&](const clap::ext::params::host::RequestFlush& request)
|
||||||
|
-> clap::ext::params::host::RequestFlush::Response {
|
||||||
|
const auto& [plugin_proxy, _] =
|
||||||
|
get_proxy(request.owner_instance_id);
|
||||||
|
|
||||||
|
plugin_proxy.host_extensions_.params->request_flush(
|
||||||
|
plugin_proxy.host_);
|
||||||
|
|
||||||
|
return Ack{};
|
||||||
|
},
|
||||||
[&](const clap::ext::tail::host::Changed& request)
|
[&](const clap::ext::tail::host::Changed& request)
|
||||||
-> clap::ext::tail::host::Changed::Response {
|
-> clap::ext::tail::host::Changed::Response {
|
||||||
// FIXME:
|
// FIXME:
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ class ClapPluginBridge : PluginBridge<ClapSockets<std::jthread>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an a message to a plugin instance's audio thread. This is separate
|
* Send a message to a plugin instance's audio thread. This is separate from
|
||||||
* from `send_message()`, which shares one socket for all plugin instances.
|
* `send_message()`, which shares one socket for all plugin instances.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename T::Response send_audio_thread_message(const T& object) {
|
typename T::Response send_audio_thread_message(const T& object) {
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ clap_host_proxy::ext_params_request_flush(const clap_host_t* host) {
|
|||||||
assert(host && host->host_data);
|
assert(host && host->host_data);
|
||||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
||||||
|
|
||||||
self->bridge_.send_main_thread_message(
|
self->bridge_.send_audio_thread_message(
|
||||||
clap::ext::params::host::RequestFlush{.owner_instance_id =
|
clap::ext::params::host::RequestFlush{.owner_instance_id =
|
||||||
self->owner_instance_id()});
|
self->owner_instance_id()});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user