Add logging for the params extension

This commit is contained in:
Robbert van der Helm
2022-09-23 17:31:42 +02:00
parent b8eb8e62bc
commit f5fc2be377
3 changed files with 175 additions and 2 deletions
+146 -2
View File
@@ -172,6 +172,64 @@ bool ClapLogger::log_request(
});
}
bool ClapLogger::log_request(bool is_host_plugin,
const clap::ext::params::plugin::Count& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.instance_id << ": clap_plugin_params::count()";
});
}
bool ClapLogger::log_request(
bool is_host_plugin,
const clap::ext::params::plugin::GetInfo& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.instance_id
<< ": clap_plugin_params::get_info(param_index = "
<< request.param_index << ", *param_info)";
});
}
bool ClapLogger::log_request(
bool is_host_plugin,
const clap::ext::params::plugin::GetValue& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.instance_id
<< ": clap_plugin_params::get_value(param_id = "
<< request.param_id << ", *value)";
});
}
bool ClapLogger::log_request(
bool is_host_plugin,
const clap::ext::params::plugin::ValueToText& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.instance_id
<< ": clap_plugin_params::value_to_text(param_id = "
<< request.param_id << ", value = " << request.value
<< ", *display, size)";
});
}
bool ClapLogger::log_request(
bool is_host_plugin,
const clap::ext::params::plugin::TextToValue& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.instance_id
<< ": clap_plugin_params::text_to_value(param_id = "
<< request.param_id << ", display = \"" << request.display
<< "\", *value)";
});
}
bool ClapLogger::log_request(bool is_host_plugin,
const clap::ext::params::plugin::Flush& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
// TODO: Add event counts
message << request.instance_id
<< ": clap_plugin_params::flush(*in, *out)";
});
}
bool ClapLogger::log_request(bool is_host_plugin,
const clap::plugin::StartProcessing& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
@@ -254,6 +312,34 @@ bool ClapLogger::log_request(
});
}
bool ClapLogger::log_request(bool is_host_plugin,
const clap::ext::params::host::Rescan& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.owner_instance_id
<< ": clap_host_params::rescan(flags = "
<< std::bitset<sizeof(request.flags) * 8>(request.flags) << ")";
});
}
bool ClapLogger::log_request(bool is_host_plugin,
const clap::ext::params::host::Clear& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.owner_instance_id
<< ": clap_host_params::clear(param_id = " << request.param_id
<< ", flags = "
<< std::bitset<sizeof(request.flags) * 8>(request.flags) << ")";
});
}
bool ClapLogger::log_request(
bool is_host_plugin,
const clap::ext::params::host::RequestFlush& request) {
return log_request_base(is_host_plugin, [&](auto& message) {
message << request.owner_instance_id
<< ": clap_host_params::request_flush()";
});
}
void ClapLogger::log_response(bool is_host_plugin, const Ack&) {
log_response_base(is_host_plugin, [&](auto& message) { message << "ACK"; });
}
@@ -333,7 +419,7 @@ void ClapLogger::log_response(
const clap::ext::audio_ports::plugin::GetResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
if (response.result) {
message << "true, <audio_port_info_t* for \""
message << "true, <clap_audio_port_info_t* for \""
<< response.result->name << "\">";
} else {
message << "false";
@@ -346,7 +432,7 @@ void ClapLogger::log_response(
const clap::ext::note_ports::plugin::GetResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
if (response.result) {
message << "true, <note_port_info_t* for \""
message << "true, <clap_note_port_info_t* for \""
<< response.result->name << "\">";
} else {
message << "false";
@@ -354,6 +440,64 @@ void ClapLogger::log_response(
});
}
void ClapLogger::log_response(
bool is_host_plugin,
const clap::ext::params::plugin::GetInfoResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
if (response.result) {
message << "true, <clap_param_info_t* for \""
<< response.result->name << "\">";
} else {
message << "false";
}
});
}
void ClapLogger::log_response(
bool is_host_plugin,
const clap::ext::params::plugin::GetValueResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
if (response.result) {
message << "true, " << *response.result;
} else {
message << "false";
}
});
}
void ClapLogger::log_response(
bool is_host_plugin,
const clap::ext::params::plugin::ValueToTextResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
if (response.result) {
message << "true, \"" << *response.result << '"';
} else {
message << "false";
}
});
}
void ClapLogger::log_response(
bool is_host_plugin,
const clap::ext::params::plugin::TextToValueResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
if (response.result) {
message << "true, " << *response.result;
} else {
message << "false";
}
});
}
void ClapLogger::log_response(
bool is_host_plugin,
const clap::ext::params::plugin::FlushResponse& response) {
return log_response_base(is_host_plugin, [&](auto& message) {
// TODO: Log output event count
message << "TODO: Log output event count";
});
}
void ClapLogger::log_response(bool is_host_plugin, const Configuration&) {
log_response_base(is_host_plugin,
[&](auto& message) { message << "<Configuration>"; });
+28
View File
@@ -85,6 +85,18 @@ class ClapLogger {
const clap::ext::note_ports::plugin::Count&);
bool log_request(bool is_host_plugin,
const clap::ext::note_ports::plugin::Get&);
bool log_request(bool is_host_plugin,
const clap::ext::params::plugin::Count&);
bool log_request(bool is_host_plugin,
const clap::ext::params::plugin::GetInfo&);
bool log_request(bool is_host_plugin,
const clap::ext::params::plugin::GetValue&);
bool log_request(bool is_host_plugin,
const clap::ext::params::plugin::ValueToText&);
bool log_request(bool is_host_plugin,
const clap::ext::params::plugin::TextToValue&);
bool log_request(bool is_host_plugin,
const clap::ext::params::plugin::Flush&);
bool log_request(bool is_host_plugin, const clap::plugin::StartProcessing&);
bool log_request(bool is_host_plugin, const clap::plugin::StopProcessing&);
@@ -102,6 +114,12 @@ class ClapLogger {
const clap::ext::note_ports::host::SupportedDialects&);
bool log_request(bool is_host_plugin,
const clap::ext::note_ports::host::Rescan&);
bool log_request(bool is_host_plugin,
const clap::ext::params::host::Rescan&);
bool log_request(bool is_host_plugin,
const clap::ext::params::host::Clear&);
bool log_request(bool is_host_plugin,
const clap::ext::params::host::RequestFlush&);
void log_response(bool is_host_plugin, const Ack&);
void log_response(bool is_host_plugin,
@@ -115,6 +133,16 @@ class ClapLogger {
const clap::ext::audio_ports::plugin::GetResponse&);
void log_response(bool is_host_plugin,
const clap::ext::note_ports::plugin::GetResponse&);
void log_response(bool is_host_plugin,
const clap::ext::params::plugin::GetInfoResponse&);
void log_response(bool is_host_plugin,
const clap::ext::params::plugin::GetValueResponse&);
void log_response(bool is_host_plugin,
const clap::ext::params::plugin::ValueToTextResponse&);
void log_response(bool is_host_plugin,
const clap::ext::params::plugin::TextToValueResponse&);
void log_response(bool is_host_plugin,
const clap::ext::params::plugin::FlushResponse&);
void log_response(bool is_host_plugin, const Configuration&);
+1
View File
@@ -24,6 +24,7 @@
#include "../utils.h"
#include "clap/ext/audio-ports.h"
#include "clap/ext/note-ports.h"
#include "clap/ext/params.h"
#include "clap/host.h"
#include "clap/plugin-factory.h"
#include "common.h"