I’m using an AudioProcessorValueTreeState to handle the parameters in my audio plugin. I’m guessing this is still the recommended best practice for this sort of thing? If not, I’m open for suggestions!
What is considered best practice regarding ranges and units for parameters in audio plugins in JUCE?
What I’ve done so far is that I’ve given all unipolar parameters the range 0.0 - 1.0, all bipolar parameters -1.0 - 1.0, and stepped parameters are A…B with step 1 (i e NormalisableRange<float> (A, B, 1.0f)).
In my editor I create my Sliders and SliderAttachments, and I enable popup displays on my Sliders by calling Slider.setPopupDisplayEnabled(true, true, nullptr).
But the tooltip will of course only show the “normalized value” of each parameter. So it will say “0.244375”, although I’d prefer to have it say something like “Room Mix: 24%” instead.
I thought that implementing the valueToText and textToValue functions when adding the parameters to the value tree would have an effect on the tooltips, but they seem to stay the same?
What would be the recommended way to change the formatting of the tooltips? Maybe I have overlooked something obvious in the API, or maybe I am going the wrong way about this entirely?
I don’t mind completely redoing the way I handle parameters if there’s a better way to do it.
That’s strange, the attachment sets the slider’s textFromValueFunction based off of what the parameter’s text conversion function is… Obviously the SliderAttachment is there since the slider displays the parameter value, but are you sure the parameter has lambdas provided for text-to-value and value-to-text? Does your slider have a text box that also exhibits this issue?
Yes, the SliderAttachment only forwards the lambdas, not the function pointers, AFAIK.
You can inherit the Slider and use the same function there, but the more modern approach is to use the lambdas:
Then it will show the value as “55%” etc! But I can’t make it say something like “Room Mix: 55%”, unless I override Slider::getTextFromValue(), I guess?
The lambdas are copied in the moment you are creating the SliderAttachment. You can easily replace them in your GUI afterwards with a different lambda than used in the processor setting the public member Slider::textFromValueFunction.
I don’t have those fields in Slider, it seems they were added recently? I’m on JUCE 5.2.0 from October 2017. But they would certainly take care of my problem, so I guess it’s time to upgrade to the latest version of JUCE now.
Thank you so much for your help, I really appreciate it!