DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit bafe8b9dd48c76cb87e5305a978adb12e7f2039a
parent 63dfb7610bc37dee69f4a303f3e3362529d95f24
Author: falkTX <falktx@falktx.com>
Date:   Wed, 11 Oct 2023 14:37:47 +0200

Declare the hardcoded dpf param symbols in the public API

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/DistrhoDetails.hpp | 20++++++++++++++++++--
Mdistrho/src/DistrhoPluginLV2export.cpp | 4++--
Mdistrho/src/DistrhoUILV2.cpp | 2+-
3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/distrho/DistrhoDetails.hpp b/distrho/DistrhoDetails.hpp @@ -224,6 +224,22 @@ enum ParameterDesignation { }; /** + Parameter designation symbols.@n + These are static, hard-coded definitions to ensure consistency across DPF and plugins. +*/ +namespace ParameterDesignationSymbols { + /** + Bypass designation symbol. + */ + static constexpr const char bypass[] = "dpf_bypass"; + + /** + Bypass designation symbol, inverted for LV2 so it becomes "enabled". + */ + static constexpr const char bypass_lv2[] = "lv2_enabled"; +}; + +/** Predefined Port Groups Ids. This enumeration provides a few commonly used groups for convenient use in plugins. @@ -731,7 +747,7 @@ struct Parameter { hints = kParameterIsAutomatable|kParameterIsBoolean|kParameterIsInteger; name = "Bypass"; shortName = "Bypass"; - symbol = "dpf_bypass"; + symbol = ParameterDesignationSymbols::bypass; unit = ""; midiCC = 0; groupId = kPortGroupNone; @@ -749,7 +765,7 @@ struct Parameter { */ static constexpr const Parameter kParameterBypass = { kParameterIsAutomatable|kParameterIsBoolean|kParameterIsInteger, - "Bypass", "Bypass", "dpf_bypass", "", "", {}, {}, 0, kPortGroupNone, + "Bypass", "Bypass", ParameterDesignationSymbols::bypass, "", "", {}, {}, 0, kPortGroupNone, }; #endif diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp @@ -748,7 +748,7 @@ void lv2_generate_ttl(const char* const basename) case kParameterDesignationBypass: designated = true; pluginString += " lv2:name \"Enabled\" ;\n"; - pluginString += " lv2:symbol \"" DISTRHO_BYPASS_PARAMETER_NAME "\" ;\n"; + pluginString += " lv2:symbol \"" + String(ParameterDesignationSymbols::bypass_lv2) + "\" ;\n"; pluginString += " lv2:default 1 ;\n"; pluginString += " lv2:minimum 0 ;\n"; pluginString += " lv2:maximum 1 ;\n"; @@ -1684,7 +1684,7 @@ void lv2_generate_ttl(const char* const basename) if (plugin.getParameterDesignation(j) == kParameterDesignationBypass) { - parameterSymbol = DISTRHO_BYPASS_PARAMETER_NAME; + parameterSymbol = ParameterDesignationSymbols::bypass_lv2; parameterValue = 1.0f - parameterValue; } diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp @@ -88,7 +88,7 @@ public: fController(controller), fWriteFunction(writeFunc), fURIDs(uridMap), - fBypassParameterIndex(fUiPortMap != nullptr ? fUiPortMap->port_index(fUiPortMap->handle, "lv2_enabled") + fBypassParameterIndex(fUiPortMap != nullptr ? fUiPortMap->port_index(fUiPortMap->handle, ParameterDesignationSymbols::bypass_lv2) : LV2UI_INVALID_PORT_INDEX), fWinIdWasNull(winId == 0), fUI(this, winId, sampleRate,