mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Add logging for CLAP callback requests
This commit is contained in:
@@ -22,6 +22,18 @@
|
||||
|
||||
ClapLogger::ClapLogger(Logger& generic_logger) : logger_(generic_logger) {}
|
||||
|
||||
void ClapLogger::log_callback_request(size_t instance_id) {
|
||||
log_request_base(false, Logger::Verbosity::all_events, [&](auto& message) {
|
||||
message << "clap_host::request_callback()";
|
||||
});
|
||||
}
|
||||
|
||||
void ClapLogger::log_on_main_thread(size_t instance_id) {
|
||||
log_request_base(true, Logger::Verbosity::all_events, [&](auto& message) {
|
||||
message << "clap_plugin::on_main_thread()";
|
||||
});
|
||||
}
|
||||
|
||||
bool ClapLogger::log_request(bool is_host_plugin,
|
||||
const clap::plugin_factory::List&) {
|
||||
return log_request_base(is_host_plugin, [&](auto& message) {
|
||||
|
||||
@@ -37,6 +37,17 @@ class ClapLogger {
|
||||
|
||||
// TODO: Logging for extension queries, factory type queries
|
||||
|
||||
/**
|
||||
* Logging for `clap_host::request_callback()`. This is handled purely on
|
||||
* the Wine plugin host side.
|
||||
*/
|
||||
void log_callback_request(size_t instance_id);
|
||||
/**
|
||||
* Logging for `clap_plugin::on_main_thread()`. This is handled purely on
|
||||
* the Wine plugin host side.
|
||||
*/
|
||||
void log_on_main_thread(size_t instance_id);
|
||||
|
||||
// For every object we send using `ClapMessageHandler` we have overloads
|
||||
// that print information about the request and the response. The boolean
|
||||
// flag here indicates whether the request was initiated on the host side
|
||||
|
||||
@@ -68,7 +68,7 @@ clap_host_proxy::host_request_callback(const struct clap_host* host) {
|
||||
assert(host && host->host_data);
|
||||
auto self = static_cast<clap_host_proxy*>(host->host_data);
|
||||
|
||||
// TODO: Log
|
||||
self->bridge_.logger_.log_callback_request(self->owner_instance_id());
|
||||
|
||||
// Only schedule a `clap_plugin::on_main_thread()` call if we don't already
|
||||
// have a pending one. This limits the number of unnecessarily stacked
|
||||
@@ -86,6 +86,9 @@ clap_host_proxy::host_request_callback(const struct clap_host* host) {
|
||||
const auto& [instance, _] = instance_lock;
|
||||
self->has_pending_host_callbacks_.store(false);
|
||||
|
||||
self->bridge_.logger_.log_on_main_thread(
|
||||
self->owner_instance_id());
|
||||
|
||||
instance.plugin->on_main_thread(instance.plugin.get());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user