mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-19 18:03:56 +02:00
Move supported extensions lists out of logger
Keeping this next to the supported extensions objects makes it easier to maintain.
This commit is contained in:
@@ -80,14 +80,8 @@ bool ClapLogger::log_request(bool is_host_plugin,
|
|||||||
<< ": clap_plugin::init(), supported host extensions: ";
|
<< ": clap_plugin::init(), supported host extensions: ";
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
const auto& supported_extensions = request.supported_host_extensions;
|
|
||||||
for (const auto& [supported, extension_name] :
|
for (const auto& [supported, extension_name] :
|
||||||
{std::pair(supported_extensions.supports_audio_ports,
|
request.supported_host_extensions.list()) {
|
||||||
CLAP_EXT_AUDIO_PORTS),
|
|
||||||
std::pair(supported_extensions.supports_note_ports,
|
|
||||||
CLAP_EXT_NOTE_PORTS),
|
|
||||||
std::pair(supported_extensions.supports_params,
|
|
||||||
CLAP_EXT_PARAMS)}) {
|
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -393,14 +387,8 @@ void ClapLogger::log_response(bool is_host_plugin,
|
|||||||
<< ", supported plugin extensions: ";
|
<< ", supported plugin extensions: ";
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
const auto& supported_extensions = response.supported_plugin_extensions;
|
|
||||||
for (const auto& [supported, extension_name] :
|
for (const auto& [supported, extension_name] :
|
||||||
{std::pair(supported_extensions.supports_audio_ports,
|
response.supported_plugin_extensions.list()) {
|
||||||
CLAP_EXT_AUDIO_PORTS),
|
|
||||||
std::pair(supported_extensions.supports_note_ports,
|
|
||||||
CLAP_EXT_NOTE_PORTS),
|
|
||||||
std::pair(supported_extensions.supports_params,
|
|
||||||
CLAP_EXT_PARAMS)}) {
|
|
||||||
if (!supported) {
|
if (!supported) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#include "host.h"
|
#include "host.h"
|
||||||
|
|
||||||
#include <clap/ext/audio-ports.h>
|
#include <clap/ext/audio-ports.h>
|
||||||
|
#include <clap/ext/note-ports.h>
|
||||||
|
#include <clap/ext/params.h>
|
||||||
|
|
||||||
namespace clap {
|
namespace clap {
|
||||||
namespace host {
|
namespace host {
|
||||||
@@ -28,5 +30,12 @@ Host::Host(const clap_host_t& original)
|
|||||||
url(original.url ? std::optional(original.url) : std::nullopt),
|
url(original.url ? std::optional(original.url) : std::nullopt),
|
||||||
version((assert(original.version), original.version)) {}
|
version((assert(original.version), original.version)) {}
|
||||||
|
|
||||||
|
std::array<std::pair<bool, const char*>, 3> SupportedHostExtensions::list()
|
||||||
|
const noexcept {
|
||||||
|
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
|
||||||
|
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
|
||||||
|
std::pair(supports_params, CLAP_EXT_PARAMS)};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace host
|
} // namespace host
|
||||||
} // namespace clap
|
} // namespace clap
|
||||||
|
|||||||
@@ -80,12 +80,17 @@ struct Host {
|
|||||||
* available to the bridged CLAP plugins using proxies.
|
* available to the bridged CLAP plugins using proxies.
|
||||||
*/
|
*/
|
||||||
struct SupportedHostExtensions {
|
struct SupportedHostExtensions {
|
||||||
// Don't forget to add new extensions to the logger and to the serialize
|
// Don't forget to add new extensions to below method
|
||||||
// method
|
|
||||||
bool supports_audio_ports = false;
|
bool supports_audio_ports = false;
|
||||||
bool supports_note_ports = false;
|
bool supports_note_ports = false;
|
||||||
bool supports_params = false;
|
bool supports_params = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of `<bool, extension_name>` tuples for the supported
|
||||||
|
* extensions. Used during logging.
|
||||||
|
*/
|
||||||
|
std::array<std::pair<bool, const char*>, 3> list() const noexcept;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
s.value1b(supports_audio_ports);
|
s.value1b(supports_audio_ports);
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
#include <clap/ext/audio-ports.h>
|
#include <clap/ext/audio-ports.h>
|
||||||
|
#include <clap/ext/note-ports.h>
|
||||||
|
#include <clap/ext/params.h>
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@@ -76,5 +78,12 @@ const clap_plugin_descriptor_t* Descriptor::get() const {
|
|||||||
return &clap_descriptor;
|
return &clap_descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::array<std::pair<bool, const char*>, 3> SupportedPluginExtensions::list()
|
||||||
|
const noexcept {
|
||||||
|
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
|
||||||
|
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
|
||||||
|
std::pair(supports_params, CLAP_EXT_PARAMS)};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace plugin
|
} // namespace plugin
|
||||||
} // namespace clap
|
} // namespace clap
|
||||||
|
|||||||
@@ -113,12 +113,17 @@ struct Descriptor {
|
|||||||
* created by `ClapPluginExtensions::supported()`.
|
* created by `ClapPluginExtensions::supported()`.
|
||||||
*/
|
*/
|
||||||
struct SupportedPluginExtensions {
|
struct SupportedPluginExtensions {
|
||||||
// Don't forget to add new extensions to the logger and to the serialize
|
// Don't forget to add new extensions to below method
|
||||||
// method
|
|
||||||
bool supports_audio_ports = false;
|
bool supports_audio_ports = false;
|
||||||
bool supports_note_ports = false;
|
bool supports_note_ports = false;
|
||||||
bool supports_params = false;
|
bool supports_params = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of `<bool, extension_name>` tuples for the supported
|
||||||
|
* extensions. Used during logging.
|
||||||
|
*/
|
||||||
|
std::array<std::pair<bool, const char*>, 3> list() const noexcept;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
s.value1b(supports_audio_ports);
|
s.value1b(supports_audio_ports);
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ if with_clap
|
|||||||
'../common/serialization/clap/ext/audio-ports.cpp',
|
'../common/serialization/clap/ext/audio-ports.cpp',
|
||||||
'../common/serialization/clap/ext/note-ports.cpp',
|
'../common/serialization/clap/ext/note-ports.cpp',
|
||||||
'../common/serialization/clap/ext/params.cpp',
|
'../common/serialization/clap/ext/params.cpp',
|
||||||
|
'../common/serialization/clap/host.cpp',
|
||||||
'../common/serialization/clap/plugin.cpp',
|
'../common/serialization/clap/plugin.cpp',
|
||||||
'bridges/clap-impls/host-proxy.cpp',
|
'bridges/clap-impls/host-proxy.cpp',
|
||||||
'bridges/clap.cpp',
|
'bridges/clap.cpp',
|
||||||
|
|||||||
Reference in New Issue
Block a user