Modify the display value of an AudioParameterFloat


Hey all,

I was looking through the (AudioFloatParameter class) and found no method to modify the displayed value of a parameter.

I am currently finishing up a compressor and was hoping to present the ratio as a ratio value. So, instead of showing a float value, would it be possible to show something like “1:1” or “1:8” etc.

I’m sorry, I’m sure this is a noob question but I appreciate any help!



I would encourage you to use the AudioProcessorValueTreeState instead. There it’s as easy as:

state.createAndAddParameter ("ratio", "Compression Ratio", TRANS ("Compression Ratio"),
                             NormalisableRange<float> (0.1, 10.0, 0.1),
                             [](float value) { return "1 : " + String (value, 1); },
                             [](const String& text) { return text.substring (3).getFloatValue(); },
                             false, true, false);

Hope that helps


Thanks! I’ll look into it!


Needs to be fixed in the API


So this pretty much explains that we must use AudioProcessorValueTreeState to do anything that would check names. For instance, I have an attack/release value and would like to modify between us, ms, s --> that means I need to have an AudioProcessorValueTreeState to do so, right?


As it currently stands, yes.

Adding lambda functions to do that for AudioParameterFloat/Choice/Int/Bool is coming soon though.


Thanks for letting me know! I appreciate it!


I apologize for asking further questions.

When I do this, my label is showing a range between the NormalisableRange values. As I understand it, the first lambda function returns some sort of string we want to display while the second retrieves the actual value we want from said string. Is there a specific method I should display it in the GUI?

I am simply following the tutorial regarding displays, so yeah. I’ve been fiddling around with this all day and am quite puzzled at what I may be doing wrong.

This is what I’ve got in code:
Plugin processor

parameters.createAndAddParameter("ratio", "Ratio", TRANS ("Ratio"),
                                NormalisableRange<float>(0.1, 10.0, 0.1),
                                [](float value)
                                     { return "1 : " + String (value, 1); }, // return 1:n
                                [](const String& text)
                                     { return text.substring(3).getFloatValue(); }); // retrieve n

Plugin Editor

ratioLabel.setText ("Ratio", dontSendNotification);
    addAndMakeVisible (ratioLabel);
    ratioSlider = new Slider (Slider::RotaryHorizontalVerticalDrag, Slider::TextBoxLeft);
    addAndMakeVisible (ratioSlider);
    ratioAttachment = new SliderAttachment (valueTreeState, "ratio", *ratioSlider);

Rectangle<int> ratioRect = MeterArea.removeFromTop(100);


That’s also a work in progress: FR+PR: valueToText of AudioProcessorValueTreeState::Parameter accessible via SliderAttachment (DRY)


Sorry, I just want to clarify. The ability to modify how the parameter values are displayed is a work in progress? Or am I missing what you are trying to convey? I truly appreciate the time you’ve taken to help out.


No, the progress is to unify that, so it happens magically by connecting using a SliderAttachment.

At the moment you can add lambdas to the AudioProcessorParameter in the AudioProcessorValueTreeState to change the display in the host.
And you can override the Slider to display the value in the TextBox. But these both have to be done individually.



Are you aware of an example of how to do this? Is there a function in the AudioProcessorValueTreeState that I must override like the SliderValueHasChanged function?


Would it be something like Slider::getValueFromText and Slider::getTextFromValue?


Exactly, those are the ones for the Slider, and for the host you use the lambdas.

I created a recyclable one in my latest project, have a look at TextFormattedSlider:

And the lambdas for that:


(I have to renew my apple dev cert, then it will be available for download)


Okay, that is absolutely brilliant. I appreciate your time and willingness to help.