Showing a label e.g. Hz, dB using AudioParameterFloat?

I remember when using the AudioProcessorValueTreeState parameter system it’s easy to show labels.

How do you do this for sliders using the AudioProcessorFloat way?

Many thanks,

You can easily do it in the Slider class: Slider::setTextValueSuffix (const String& suffix)

Then you can eventually generalize using the AudioProcessorParameter’s Label, at least the documentation suggests the label might be used for that purpose:

slider->setTextValueSuffix (parameter->getLabel());

Hope that helps


Although my usual procedure is to create a AudioParameterFloat and then use addParameter() in the the PluginProcessor constructor.

Looking at the AudioParameterFloat there seems to be no way to conveniently set the label?

(Apart from awkward dynamic cast to AudioProcessorParameterWithID and then set label??)

You are right, the super class of AudioParameterFloat, AudioProcessorParameterWithID implements getLabel(), but setLabel is not supported and I can’t find a constructor parameter either.
@juce: is this missing? forgotten, or no longer wanted?

So if there was a setLabel method, I think you can do like:

addParameter (AudioParameterFloat* myFloat = new AudioParameterFloat ("myID", "myName", etc);
myFloat->setLabel (" Hz");
1 Like