diff --git a/src/common/logging/clap.cpp b/src/common/logging/clap.cpp index 2f01ac48..b9013eaa 100644 --- a/src/common/logging/clap.cpp +++ b/src/common/logging/clap.cpp @@ -18,6 +18,8 @@ #include +#include + #include "../serialization/clap.h" ClapLogger::ClapLogger(Logger& generic_logger) : logger_(generic_logger) {} @@ -56,21 +58,23 @@ bool ClapLogger::log_request(bool is_host_plugin, message << request.instance_id << ": clap_plugin::init(), supported host extensions: "; - // TODO: Log supported extensions bool first = true; - // for (const auto& [supported, extension_name] : {}) { - // if (!supported) { - // continue; - // } + const auto& supported_extensions = request.supported_host_extensions; + for (const auto& [supported, extension_name] : + {std::pair(supported_extensions.supports_audio_ports, + CLAP_EXT_AUDIO_PORTS)}) { + if (!supported) { + continue; + } - // if (first) { - // message << extension_name; - // } else { - // message << ", " << extension_name; - // } + if (first) { + message << '"' << extension_name << '"'; + } else { + message << ", \"" << extension_name << '"'; + } - // first = false; - // } + first = false; + } if (first) { message << ""; @@ -182,21 +186,23 @@ void ClapLogger::log_response(bool is_host_plugin, message << (response.result ? "true" : "false") << ", supported plugin extensions: "; - // TODO: Log supported extensions bool first = true; - // for (const auto& [supported, extension_name] : {}) { - // if (!supported) { - // continue; - // } + const auto& supported_extensions = response.supported_plugin_extensions; + for (const auto& [supported, extension_name] : + {std::pair(supported_extensions.supports_audio_ports, + CLAP_EXT_AUDIO_PORTS)}) { + if (!supported) { + continue; + } - // if (first) { - // message << extension_name; - // } else { - // message << ", " << extension_name; - // } + if (first) { + message << '"' << extension_name << '"'; + } else { + message << ", \"" << extension_name << '"'; + } - // first = false; - // } + first = false; + } if (first) { message << ""; diff --git a/src/common/serialization/clap/host.cpp b/src/common/serialization/clap/host.cpp index d2841ef7..93a2cfc9 100644 --- a/src/common/serialization/clap/host.cpp +++ b/src/common/serialization/clap/host.cpp @@ -16,6 +16,8 @@ #include "host.h" +#include + namespace clap { namespace host { @@ -26,8 +28,8 @@ Host::Host(const clap_host_t& original) url(original.url ? std::optional(original.url) : std::nullopt), version((assert(original.version), original.version)) {} -// TODO: Add extensions -SupportedHostExtensions::SupportedHostExtensions(const clap_host& host) {} +SupportedHostExtensions::SupportedHostExtensions(const clap_host& host) + : supports_audio_ports(host.get_extension(&host, CLAP_EXT_AUDIO_PORTS)) {} } // namespace host } // namespace clap diff --git a/src/common/serialization/clap/host.h b/src/common/serialization/clap/host.h index cee25380..856cb00f 100644 --- a/src/common/serialization/clap/host.h +++ b/src/common/serialization/clap/host.h @@ -87,11 +87,11 @@ struct SupportedHostExtensions { SupportedHostExtensions() noexcept {} // Don't forget to add new extensions to the log output - // TODO: Support extensions + bool supports_audio_ports = false; template void serialize(S& s) { - // s.value1b(extension_name); + s.value1b(supports_audio_ports); } }; diff --git a/src/common/serialization/clap/plugin.cpp b/src/common/serialization/clap/plugin.cpp index ef0b67d5..3798e337 100644 --- a/src/common/serialization/clap/plugin.cpp +++ b/src/common/serialization/clap/plugin.cpp @@ -16,6 +16,8 @@ #include "plugin.h" +#include + #include "version.h" namespace clap { @@ -74,9 +76,9 @@ const clap_plugin_descriptor_t* Descriptor::get() const { return &clap_descriptor; } -// TODO: Add extensions -SupportedPluginExtensions::SupportedPluginExtensions( - const clap_plugin& plugin) {} +SupportedPluginExtensions::SupportedPluginExtensions(const clap_plugin& plugin) + : supports_audio_ports( + plugin.get_extension(&plugin, CLAP_EXT_AUDIO_PORTS)) {} } // namespace plugin } // namespace clap diff --git a/src/common/serialization/clap/plugin.h b/src/common/serialization/clap/plugin.h index 9e07c90c..9e2d5eae 100644 --- a/src/common/serialization/clap/plugin.h +++ b/src/common/serialization/clap/plugin.h @@ -120,11 +120,11 @@ struct SupportedPluginExtensions { SupportedPluginExtensions() noexcept {} // Don't forget to add new extensions to the log output - // TODO: Support extensions + bool supports_audio_ports = false; template void serialize(S& s) { - // s.value1b(extension_name); + s.value1b(supports_audio_ports); } };