From 08d00ca64b40f7138b038dc76c5238489b271e69 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Wed, 17 Jun 2026 10:11:29 +0200 Subject: [PATCH 1/6] Update submodules --- clap | 2 +- clap-helpers | 2 +- vcpkg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clap b/clap index 89b761c..275a785 160000 --- a/clap +++ b/clap @@ -1 +1 @@ -Subproject commit 89b761cb5f4adebc33c0abb3882f3feadbc039dc +Subproject commit 275a78500a978d4b25349509b27f554d7dfe575e diff --git a/clap-helpers b/clap-helpers index 2a37588..3f14992 160000 --- a/clap-helpers +++ b/clap-helpers @@ -1 +1 @@ -Subproject commit 2a37588b8e0838a376162023b8df7c8290e73214 +Subproject commit 3f1499269503af3b01a2ebfab7a4543d2dcdcf2d diff --git a/vcpkg b/vcpkg index 3002390..5d35de2 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 300239058e33420acd153135b3f6e6b187828992 +Subproject commit 5d35de2ee8b13d0bcec328153605638a74fbbf84 From a7c40c9a75e13e714708ed046ae8fb677cf9921a Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Wed, 17 Jun 2026 10:11:49 +0200 Subject: [PATCH 2/6] Add support for params origin --- plugins/core-plugin.cc | 14 ++++++++++++++ plugins/core-plugin.hh | 6 ++++++ plugins/parameter.cc | 4 +++- plugins/parameters.hh | 3 ++- plugins/value-types/value-type.hh | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/plugins/core-plugin.cc b/plugins/core-plugin.cc index 6929ab1..6cc54e3 100644 --- a/plugins/core-plugin.cc +++ b/plugins/core-plugin.cc @@ -869,6 +869,20 @@ namespace clap { return p; } + //---------------------------// + // clap_plugin_params_origin // + //---------------------------// + bool CorePlugin::implementsParamsOrigin() const noexcept { return true; } + + bool CorePlugin::paramsOriginGet(clap_id param_id, double *out_value) noexcept { + auto param = _parameters.getById(param_id); + if (!param) + return false; + + *out_value = param->valueType()->originValue(); + return true; + } + bool CorePlugin::implementsVoiceInfo() const noexcept { return true; } bool CorePlugin::voiceInfoDoGet(clap_voice_info *info) noexcept { diff --git a/plugins/core-plugin.hh b/plugins/core-plugin.hh index 674ff70..301a597 100644 --- a/plugins/core-plugin.hh +++ b/plugins/core-plugin.hh @@ -149,6 +149,12 @@ namespace clap { uint32_t automation_state, const clap_color_t *color) noexcept override; + //---------------------------// + // clap_plugin_params_origin // + //---------------------------// + bool implementsParamsOrigin() const noexcept override; + bool paramsOriginGet(clap_id param_id, double *out_value) noexcept override; + //-------------------// // clap_plugin_state // //-------------------// diff --git a/plugins/parameter.cc b/plugins/parameter.cc index d67df0a..089f16f 100644 --- a/plugins/parameter.cc +++ b/plugins/parameter.cc @@ -1,7 +1,9 @@ #include "parameter.hh" namespace clap { - Parameter::Parameter(const clap_param_info &info, std::unique_ptr valueType, uint32_t paramIndex) + Parameter::Parameter(const clap_param_info &info, + std::unique_ptr valueType, + uint32_t paramIndex) : _index(paramIndex), _info(info), _valueType(std::move(valueType)) { _info.cookie = this; reset(); diff --git a/plugins/parameters.hh b/plugins/parameters.hh index 1fff691..94e2947 100644 --- a/plugins/parameters.hh +++ b/plugins/parameters.hh @@ -19,7 +19,8 @@ namespace clap { Parameters() = default; Parameters(const Parameters ¶meters); - Parameter *addParameter(const clap_param_info &info, std::unique_ptr valueType); + Parameter *addParameter(const clap_param_info &info, + std::unique_ptr valueType); size_t count() const noexcept; diff --git a/plugins/value-types/value-type.hh b/plugins/value-types/value-type.hh index f2df779..29a147a 100644 --- a/plugins/value-types/value-type.hh +++ b/plugins/value-types/value-type.hh @@ -18,6 +18,7 @@ namespace clap { [[nodiscard]] virtual double defaultValue() const noexcept { return std::numeric_limits::lowest(); } [[nodiscard]] virtual double minValue() const noexcept { return std::numeric_limits::lowest(); } [[nodiscard]] virtual double maxValue() const noexcept { return std::numeric_limits::max(); } + [[nodiscard]] virtual double originValue() const noexcept { return minValue(); } [[nodiscard]] virtual std::string toText(double paramValue) const = 0; [[nodiscard]] virtual double fromText(const std::string ¶mValueText) const = 0; From 32117d394ce0dfdab55ef436c26bf843c0d9f3a0 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Wed, 17 Jun 2026 12:24:01 +0200 Subject: [PATCH 3/6] Update submodules --- clap-helpers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clap-helpers b/clap-helpers index 3f14992..93ce08c 160000 --- a/clap-helpers +++ b/clap-helpers @@ -1 +1 @@ -Subproject commit 3f1499269503af3b01a2ebfab7a4543d2dcdcf2d +Subproject commit 93ce08c47dab9199a00b54cb94695f423a355be4 From 9709abf117b88b7c973d7af69687d1b2cb065ca2 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Wed, 17 Jun 2026 12:24:16 +0200 Subject: [PATCH 4/6] Support flush events --- plugins/core-plugin.cc | 20 +++++++++++++++++--- plugins/core-plugin.hh | 7 +++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/plugins/core-plugin.cc b/plugins/core-plugin.cc index 6cc54e3..59147c0 100644 --- a/plugins/core-plugin.cc +++ b/plugins/core-plugin.cc @@ -342,16 +342,25 @@ namespace clap { } void CorePlugin::pushGuiToPluginEvent(const GuiToPluginEvent &event) { + if (!_host.canUseFlushEvents() && !_host.canUseParams()) + return; + // very highly likely to succeed while (!_guiToPluginQueue.tryPush(event)) { - if (_host.canUseParams()) + if (_host.canUseFlushEvents()) + _host.flushEventsRequestFlush(); + else if (_host.canUseParams()) _host.paramsRequestFlush(); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } - if (!isProcessing() && _host.canUseParams()) - _host.paramsRequestFlush(); + if (!isProcessing() && _host.canUseParams()) { + if (_host.canUseFlushEvents()) + _host.flushEventsRequestFlush(); + else if (_host.canUseParams()) + _host.paramsRequestFlush(); + } } void CorePlugin::onGuiSetTransportIsSubscribed(bool isSubscribed) { @@ -714,6 +723,11 @@ namespace clap { void CorePlugin::paramsFlush(const clap_input_events *in, const clap_output_events *out) noexcept { + flushEventsFlush(in, out); + } + + void CorePlugin::flushEventsFlush(const clap_input_events *in, + const clap_output_events *out) noexcept { if (in) { const uint32_t N = in->size(in); for (uint32_t i = 0; i < N; ++i) { diff --git a/plugins/core-plugin.hh b/plugins/core-plugin.hh index 301a597..b670ccc 100644 --- a/plugins/core-plugin.hh +++ b/plugins/core-plugin.hh @@ -134,6 +134,13 @@ namespace clap { int32_t getParamIndexForParamId(clap_id paramId) const noexcept override; + //--------------------------// + // clap_plugin_flush_events // + //--------------------------// + bool implementsFlushEvents() const noexcept override { return true; } + void flushEventsFlush(const clap_input_events *in, + const clap_output_events *out) noexcept override; + //------------------------------// // clap_plugin_param_indication // //------------------------------// From 66a96207c5ff7278b2f3bc70cde1ce07ec80de49 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Wed, 17 Jun 2026 12:32:19 +0200 Subject: [PATCH 5/6] C++ still doesn't have case compare?? --- plugins/value-types/boolean-value-type.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/value-types/boolean-value-type.cc b/plugins/value-types/boolean-value-type.cc index 591bce2..f937cba 100644 --- a/plugins/value-types/boolean-value-type.cc +++ b/plugins/value-types/boolean-value-type.cc @@ -14,11 +14,12 @@ namespace clap { } double BooleanValueType::fromText(const std::string ¶mValueText) const { - if (::strcasecmp(paramValueText.c_str(), "true") || ::strcasecmp(paramValueText.c_str(), "1")) + if (::strcmp(paramValueText.c_str(), "true") || ::strcmp(paramValueText.c_str(), "True") || + ::strcmp(paramValueText.c_str(), "TRUE") || ::strcmp(paramValueText.c_str(), "1")) return true; - if (::strcasecmp(paramValueText.c_str(), "false") || - ::strcasecmp(paramValueText.c_str(), "0")) + if (::strcmp(paramValueText.c_str(), "false") || ::strcmp(paramValueText.c_str(), "False") || + ::strcmp(paramValueText.c_str(), "FALSE") || ::strcmp(paramValueText.c_str(), "0")) return true; return _defaultValue; From 3dd64675ceb51bedbd84bd2ce0c56cda39f98865 Mon Sep 17 00:00:00 2001 From: Alexandre Bique Date: Thu, 18 Jun 2026 10:07:09 +0200 Subject: [PATCH 6/6] Make the gain plugin configure the value origin --- plugins/plugs/gain/gain.cc | 2 +- plugins/value-types/decibel-value-type.cc | 3 ++- plugins/value-types/decibel-value-type.hh | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/plugs/gain/gain.cc b/plugins/plugs/gain/gain.cc index 86a3262..d1868f4 100644 --- a/plugins/plugs/gain/gain.cc +++ b/plugins/plugs/gain/gain.cc @@ -13,7 +13,7 @@ namespace clap { "gain", CLAP_PARAM_IS_AUTOMATABLE | CLAP_PARAM_IS_MODULATABLE | CLAP_PARAM_REQUIRES_PROCESS, - std::make_unique(-40, 40, 0)); + std::make_unique(-40, 40, 0, 0)); } clap_process_status process(const Context &c, uint32_t numFrames) noexcept override { diff --git a/plugins/value-types/decibel-value-type.cc b/plugins/value-types/decibel-value-type.cc index 4cf47f0..f79d96e 100644 --- a/plugins/value-types/decibel-value-type.cc +++ b/plugins/value-types/decibel-value-type.cc @@ -5,7 +5,8 @@ namespace clap { - DecibelValueType::DecibelValueType(double min, double max, double dflt) : _minValue(min), _maxValue(max), _defaultValue(dflt) {} + DecibelValueType::DecibelValueType(double min, double max, double dflt, double originValue) + : _minValue(min), _maxValue(max), _defaultValue(dflt), _originValue(originValue) {} std::string DecibelValueType::toText(double paramValue) const { std::ostringstream os; diff --git a/plugins/value-types/decibel-value-type.hh b/plugins/value-types/decibel-value-type.hh index 78bfa20..6bc50d0 100644 --- a/plugins/value-types/decibel-value-type.hh +++ b/plugins/value-types/decibel-value-type.hh @@ -7,11 +7,15 @@ namespace clap { class DecibelValueType final : public ValueType { public: - DecibelValueType(double min = -120, double max = +120, double defaultValue = 0); + DecibelValueType(double min = -120, + double max = +120, + double defaultValue = 0, + double originValue = 0); double minValue() const noexcept override { return _minValue; } double maxValue() const noexcept override { return _maxValue; } double defaultValue() const noexcept override { return _defaultValue; } + double originValue() const noexcept override { return _originValue; } std::string toText(double paramValue) const override; double fromText(const std::string ¶mValueText) const override; @@ -24,5 +28,6 @@ namespace clap { const double _minValue; const double _maxValue; const double _defaultValue; + const double _originValue; }; } // namespace clap