From 49e3f7ff1ec7d34bfe34e70cf43640d4c145fe9c Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 7 Sep 2022 17:21:54 +0200 Subject: [PATCH] Capitalize CLAP plugin descriptor class name To stay consistent with the rest of the naming. --- src/common/serialization/clap/plugin-factory.h | 2 +- src/common/serialization/clap/plugin.cpp | 4 ++-- src/common/serialization/clap/plugin.h | 6 +++--- src/plugin/bridges/clap-impls/plugin-factory-proxy.cpp | 2 +- src/plugin/bridges/clap-impls/plugin-factory-proxy.h | 9 +++++++-- src/wine-host/bridges/clap.cpp | 2 +- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/common/serialization/clap/plugin-factory.h b/src/common/serialization/clap/plugin-factory.h index b5dcd7f9..72757ad5 100644 --- a/src/common/serialization/clap/plugin-factory.h +++ b/src/common/serialization/clap/plugin-factory.h @@ -31,7 +31,7 @@ struct ListResponse { * The descriptors for the plugins in the factory. This will be a nullopt if * the plugin does not support the plugin factory. */ - std::optional> descriptors; + std::optional> descriptors; template void serialize(S& s) { diff --git a/src/common/serialization/clap/plugin.cpp b/src/common/serialization/clap/plugin.cpp index 49a36255..7c19837c 100644 --- a/src/common/serialization/clap/plugin.cpp +++ b/src/common/serialization/clap/plugin.cpp @@ -21,7 +21,7 @@ namespace clap { namespace plugin { -descriptor::descriptor(const clap_plugin_descriptor_t& original) +Descriptor::Descriptor(const clap_plugin_descriptor_t& original) : clap_version(original.clap_version), id((assert(original.id), original.id)), name((assert(original.name), original.name)), @@ -45,7 +45,7 @@ descriptor::descriptor(const clap_plugin_descriptor_t& original) } } -const clap_plugin_descriptor_t* descriptor::get() const { +const clap_plugin_descriptor_t* Descriptor::get() const { // This should be the minimum of yabridge's supported CLAP version and // the plugin's supported CLAP version clap_version_t supported_clap_version = clamp_clap_version(clap_version); diff --git a/src/common/serialization/clap/plugin.h b/src/common/serialization/clap/plugin.h index 8a6b4ffc..a2b247a7 100644 --- a/src/common/serialization/clap/plugin.h +++ b/src/common/serialization/clap/plugin.h @@ -33,17 +33,17 @@ namespace plugin { /** * Owned wrapper around `clap_plugin_descriptor` for serialization purposes. */ -struct descriptor { +struct Descriptor { /** * Parse a plugin-provided descriptor so it can be serialized and sent to * the native CLAP plugin. */ - descriptor(const clap_plugin_descriptor_t& original); + Descriptor(const clap_plugin_descriptor_t& original); /** * Default constructor for bitsery. */ - descriptor() {} + Descriptor() {} /** * We'll report the maximum of the plugin's supported CLAP version and diff --git a/src/plugin/bridges/clap-impls/plugin-factory-proxy.cpp b/src/plugin/bridges/clap-impls/plugin-factory-proxy.cpp index 5bdcb734..86881259 100644 --- a/src/plugin/bridges/clap-impls/plugin-factory-proxy.cpp +++ b/src/plugin/bridges/clap-impls/plugin-factory-proxy.cpp @@ -20,7 +20,7 @@ clap_plugin_factory_proxy::clap_plugin_factory_proxy( ClapPluginBridge& bridge, - std::vector descriptors) + std::vector descriptors) : plugin_factory_vtable(clap_plugin_factory_t{ .get_plugin_count = plugin_factory_get_plugin_count, .get_plugin_descriptor = plugin_factory_get_plugin_descriptor, diff --git a/src/plugin/bridges/clap-impls/plugin-factory-proxy.h b/src/plugin/bridges/clap-impls/plugin-factory-proxy.h index d6c343b7..f069ca3c 100644 --- a/src/plugin/bridges/clap-impls/plugin-factory-proxy.h +++ b/src/plugin/bridges/clap-impls/plugin-factory-proxy.h @@ -34,6 +34,11 @@ class clap_plugin_factory_proxy { * The vtable for `clap_plugin_factory`, requires that this object is never * moved or copied. This is positioned at the start of the struct so we can * cast between them (with only a bit of UB). + * + * NOTE: CLAP does not provide a user pointer field for this vtable like it + * does with other types because it expects the factory to be a + * statically initialized singleton. That's why we need to do this + * cast instead. */ const clap_plugin_factory_t plugin_factory_vtable; @@ -43,7 +48,7 @@ class clap_plugin_factory_proxy { */ clap_plugin_factory_proxy( ClapPluginBridge& bridge, - std::vector descriptors); + std::vector descriptors); clap_plugin_factory_proxy(const clap_plugin_factory_proxy&) = delete; clap_plugin_factory_proxy& operator=(const clap_plugin_factory_proxy&) = @@ -65,5 +70,5 @@ class clap_plugin_factory_proxy { private: ClapPluginBridge& bridge_; - std::vector descriptors_; + std::vector descriptors_; }; diff --git a/src/wine-host/bridges/clap.cpp b/src/wine-host/bridges/clap.cpp index bb53d155..3d722d83 100644 --- a/src/wine-host/bridges/clap.cpp +++ b/src/wine-host/bridges/clap.cpp @@ -149,7 +149,7 @@ void ClapBridge::run() { .descriptors = std::nullopt}; } - std::vector descriptors; + std::vector descriptors; const uint32_t num_plugins = (factory->get_plugin_count)(factory); for (uint32_t i = 0; i < num_plugins; i++) {