Fix maximumStringLength usage in jucewrapper, used for AU
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
e6e3fb7ad3
commit
ef3ba8fee7
1 changed files with 10 additions and 3 deletions
|
|
@ -69,7 +69,8 @@ protected:
|
||||||
|
|
||||||
juce::String getName(const int maximumStringLength) const override
|
juce::String getName(const int maximumStringLength) const override
|
||||||
{
|
{
|
||||||
DISTRHO_SAFE_ASSERT_RETURN(maximumStringLength > 0, {});
|
if (maximumStringLength <= 0)
|
||||||
|
return juce::String(plugin.getParameterName(index).buffer());
|
||||||
|
|
||||||
return juce::String(plugin.getParameterName(index).buffer(), static_cast<size_t>(maximumStringLength));
|
return juce::String(plugin.getParameterName(index).buffer(), static_cast<size_t>(maximumStringLength));
|
||||||
}
|
}
|
||||||
|
|
@ -111,8 +112,6 @@ protected:
|
||||||
|
|
||||||
juce::String getText(const float normalizedValue, const int maximumStringLength) const override
|
juce::String getText(const float normalizedValue, const int maximumStringLength) const override
|
||||||
{
|
{
|
||||||
DISTRHO_SAFE_ASSERT_RETURN(maximumStringLength > 0, {});
|
|
||||||
|
|
||||||
float value = ranges.getUnnormalizedValue(normalizedValue);
|
float value = ranges.getUnnormalizedValue(normalizedValue);
|
||||||
|
|
||||||
if (hints & kParameterIsBoolean)
|
if (hints & kParameterIsBoolean)
|
||||||
|
|
@ -130,9 +129,14 @@ protected:
|
||||||
for (uint32_t i=0; i < enumValues.count; ++i)
|
for (uint32_t i=0; i < enumValues.count; ++i)
|
||||||
{
|
{
|
||||||
if (d_isEqual(enumValues.values[i].value, value))
|
if (d_isEqual(enumValues.values[i].value, value))
|
||||||
|
{
|
||||||
|
if (maximumStringLength <= 0)
|
||||||
|
return juce::String(enumValues.values[i].label);
|
||||||
|
|
||||||
return juce::String(enumValues.values[i].label, static_cast<size_t>(maximumStringLength));
|
return juce::String(enumValues.values[i].label, static_cast<size_t>(maximumStringLength));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
juce::String text;
|
juce::String text;
|
||||||
if (hints & kParameterIsInteger)
|
if (hints & kParameterIsInteger)
|
||||||
|
|
@ -140,6 +144,9 @@ protected:
|
||||||
else
|
else
|
||||||
text = juce::String(value);
|
text = juce::String(value);
|
||||||
|
|
||||||
|
if (maximumStringLength <= 0)
|
||||||
|
return text;
|
||||||
|
|
||||||
return juce::String(text.toRawUTF8(), static_cast<size_t>(maximumStringLength));
|
return juce::String(text.toRawUTF8(), static_cast<size_t>(maximumStringLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue