AudioProcessorValueTree, NormalisableRange and SliderAttachment

Hi,
we are evaluating if our parameter handling could be simplified by using AudioProcessorValueTree.

  • what needs to be done, so the SliderAttachment displays the real parameter instead of its normalised representation? Why doesn’t the Sliders value Label use the valueToTextFunction and textToValueFunction?
  • the DAW (Cubase 8.5) correctly displays a valueToTextFunction generated drop down list of valid values in its automation track, while its Generic Editor seems to ignore the NormalisableRange::intervalValue.

Cheers,
raketa

https://www.juce.com/doc/tutorial_audio_processor_value_tree_state
fails to demonstrate the use of NormalisableRange: it would be nice if tutorial_audio_processor_value_tree_state could demonstrate the level slider with a dB range.

It also fails to handle automation - a basic feature of a parameter class. So what should it demonstrate then?

Could you please be more specific? What is going wrong? Which operating system, DAW and JUCE version are you using?

I fixed an Studio One automation bug a few months ago on the develop branch and I tested it afterwards on many different hosts and platforms without discovering anything amiss.

It does use the valueToTextFunction… you can see it in the source code. If you change the first parameter in the tutorial to be

    parameters.createAndAddParameter ("gain",       // parameterID
                                      "Gain",       // parameter name
                                      String(),     // parameter label (suffix)
                                      NormalisableRange<float> (-1.0f, 1.0f, 1.0),    // range
                                      0.0f,         // default value
                                      [](float value) { return String (value); },
                                      nullptr);

(expanding the range, adding an interval value, and adding a valueToText function) then I can see the parameter value change from -1 to 1 discontinuously via {-1.0, 0.0, 1.0} as expected. The generic editor is free to attempt to set any value from 0 to 1, but the actual values set will always be one of the interval ones and you can see this in the label displayed and the GUI.

1 Like

Thanks t0m,

Could you please be more specific? What is going wrong? Which operating system, DAW and JUCE version are you using?

Yes, you are right: Its only my derivate that doesn’t handle automation. The original works.

It does use the valueToTextFunction… you can see it in the source code. If you change the first parameter in the tutorial to be
No, the UI SliderAttachment doesn’t use it. I see that its displayed in the automation though. The question was what needs to be done, so the slider displays it correctly? Do I have to inherit from SliderAttachment? And then? What would I overwrite?

I’m still a bit confused what you are asking. The tutorial shows how to use a SliderAttachment and the displayed values are definitely correct. For the code I posted above I can move the slider between -1.0 and 1.0…

Could you show us some code that doesn’t display parameter values correctly?

Hi t0m,

I am really sorry, all my mistake: I mis-translated the numerical AudioProcessorParameter::getParameterIndex() to the String id of the SliderAttachment.

Everything seems to work perfectly now, sorry for the turbulence…

Cheers,
raketa.