Closes #163 Signed-off-by: falkTX <falktx@falktx.com>pull/165/head
@@ -384,6 +384,13 @@ struct Parameter { | |||||
*/ | */ | ||||
String name; | String name; | ||||
/** | |||||
The short name of this parameter.@n | |||||
Used when displaying the parameter name in a very limited space. | |||||
@note This value is optional, the full name is used when the short one is missing. | |||||
*/ | |||||
String shortName; | |||||
/** | /** | ||||
The symbol of this parameter.@n | The symbol of this parameter.@n | ||||
A parameter symbol is a short restricted name used as a machine and human readable identifier.@n | A parameter symbol is a short restricted name used as a machine and human readable identifier.@n | ||||
@@ -430,6 +437,7 @@ struct Parameter { | |||||
Parameter() noexcept | Parameter() noexcept | ||||
: hints(0x0), | : hints(0x0), | ||||
name(), | name(), | ||||
shortName(), | |||||
symbol(), | symbol(), | ||||
unit(), | unit(), | ||||
ranges(), | ranges(), | ||||
@@ -443,6 +451,7 @@ struct Parameter { | |||||
Parameter(uint32_t h, const char* n, const char* s, const char* u, float def, float min, float max) noexcept | Parameter(uint32_t h, const char* n, const char* s, const char* u, float def, float min, float max) noexcept | ||||
: hints(h), | : hints(h), | ||||
name(n), | name(n), | ||||
shortName(), | |||||
symbol(s), | symbol(s), | ||||
unit(u), | unit(u), | ||||
ranges(def, min, max), | ranges(def, min, max), | ||||
@@ -462,11 +471,12 @@ struct Parameter { | |||||
case kParameterDesignationNull: | case kParameterDesignationNull: | ||||
break; | break; | ||||
case kParameterDesignationBypass: | case kParameterDesignationBypass: | ||||
hints = kParameterIsAutomable|kParameterIsBoolean|kParameterIsInteger; | |||||
name = "Bypass"; | |||||
symbol = "dpf_bypass"; | |||||
unit = ""; | |||||
midiCC = 0; | |||||
hints = kParameterIsAutomable|kParameterIsBoolean|kParameterIsInteger; | |||||
name = "Bypass"; | |||||
shortName = "Bypass"; | |||||
symbol = "dpf_bypass"; | |||||
unit = ""; | |||||
midiCC = 0; | |||||
ranges.def = 0.0f; | ranges.def = 0.0f; | ||||
ranges.min = 0.0f; | ranges.min = 0.0f; | ||||
ranges.max = 1.0f; | ranges.max = 1.0f; | ||||
@@ -375,6 +375,13 @@ public: | |||||
return fData->parameters[index].name; | return fData->parameters[index].name; | ||||
} | } | ||||
const String& getParameterShortName(const uint32_t index) const noexcept | |||||
{ | |||||
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, sFallbackString); | |||||
return fData->parameters[index].shortName; | |||||
} | |||||
const String& getParameterSymbol(const uint32_t index) const noexcept | const String& getParameterSymbol(const uint32_t index) const noexcept | ||||
{ | { | ||||
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, sFallbackString); | DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, sFallbackString); | ||||
@@ -440,6 +440,12 @@ void lv2_generate_ttl(const char* const basename) | |||||
pluginString += " lv2:symbol \"" + symbol + "\" ;\n"; | pluginString += " lv2:symbol \"" + symbol + "\" ;\n"; | ||||
// short name | |||||
const String& shortName(plugin.getParameterShortName(i)); | |||||
if (shortName.isNotEmpty()) | |||||
pluginString += " lv2:shortName \"" + shortName + "\" ;\n"; | |||||
// ranges | // ranges | ||||
const ParameterRanges& ranges(plugin.getParameterRanges(i)); | const ParameterRanges& ranges(plugin.getParameterRanges(i)); | ||||
@@ -1294,7 +1294,11 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t | |||||
case effGetParamName: | case effGetParamName: | ||||
if (ptr != nullptr && index < static_cast<int32_t>(plugin.getParameterCount())) | if (ptr != nullptr && index < static_cast<int32_t>(plugin.getParameterCount())) | ||||
{ | { | ||||
DISTRHO_NAMESPACE::strncpy((char*)ptr, plugin.getParameterName(index), 16); | |||||
const String& shortName(plugin.getParameterShortName(index)); | |||||
if (shortName.isNotEmpty()) | |||||
DISTRHO_NAMESPACE::strncpy((char*)ptr, shortName, 16); | |||||
else | |||||
DISTRHO_NAMESPACE::strncpy((char*)ptr, plugin.getParameterName(index), 16); | |||||
return 1; | return 1; | ||||
} | } | ||||
return 0; | return 0; | ||||