AudioParameterFloat - different constructor behavior


I’m seeing some odd behavior with display of plugin value/text depending on which constructor I use (first one uses NormalisableRange second one uses float minValue, float maxValue, float defaultValue).

When running in Ableton Live 10, I see the display of text in the automation lane when changing the value with mouse and in the plugin parameter page differently. The text is displayed in what looks like the raw 0.0 to 1.0 range in when using the first constructor and in the range of the min/max (0 to 100) when using the second constructor. I want to append a percent sign to the value shown and the first constructor is the only way to set that.

I’ve created two parameter using the different constructors to demonstrate the behavior. I’ve tweaked around with the values for the NormalisableRange but nothing seems to fix this issue.

Is this a known issue in Live or with the AudioParameterFloat class?

auto stringFromVal = [] (float v, int length)
    String asText (v, 2);
    return length > 0 ? asText.substring (0, length) : asText;

addParameter (Gain1_ = new AudioParameterFloat ("Gain1_", "Gain1", {0.0f, 100.0f, 0.01f, 1.0f}, 100.0f, "%"
                                                     , juce::AudioParameterBool::genericParameter, stringFromVal));
addParameter (Gain2_ = new AudioParameterFloat ("Gain2_", "Gain2", 0.0f, 100.0f, 100.0f));

The UI drawn by my plugin editor uses the following code. The coreValue returns the 0.0 1.0 value and the other two return the desired percent value (22.03%).

    auto coreValue = param->getValue();
    auto value = param->getCurrentValueAsText() + "%";
    auto valueText = param->getText(coreValue, 4) + "%";

Here are screenshots of the UI:

27%20PM 38%20PM 41%20PM

Is this an AU or a VST plug-in?

Unfortunately the label parameter of the constructor is a little problematic. VST and VST3 support associating label/unit with a parameter, which can be presented to the user in a different way to simply appending a string with the string for the label. For AU and AUv3 this parameter is ignored, so the best cross-plug-in-format solution is to add a " %" string to the end of what you return from your stringFromVal function. This makes things work as expected in the generic parameter views and automation lanes in Logic (AU) and REAPER (AU,VST,VST3), and in the generic parameter views in Live (AU,VST).

This differs from what you’re seeing, but I’m not sure why. I’ve added thes lines to an AudioProcessor:

auto stringFromVal = [](float v, int length)
    String asText (v, 2);
    return (length > 0 ? asText.substring (0, length) : asText) + " %";

addParameter (new AudioParameterFloat ("Gain1_", "Gain1", {0.0f, 100.0f, 0.01f, 1.0f}, 100.0f, {},
                                       AudioParameterFloat::genericParameter, stringFromVal));
addParameter (new AudioParameterFloat ("Gain2_", "Gain2", 0.0f, 100.0f, 100.0f));

My “Gain1” parameter displays as a correct percentage in the generic parameter view, and both display as a normalised value in the automation lanes, in both AU and VST formats.

I’m using VST3.

I’ll experiment around a little more.

Thanks for looking at this.


VST3 in Ableton is working as expected for me, including a non-normalised " %"-appended value in the automation lane.

Are you using the develop branch of JUCE? We might have changed things since the last release. I’m using Live 10.1.

I was able to get things to work using your solution of appending the % in the customized stringFromVal.
I tested on master and on 5.4.3.

Thanks for the help.