NormalisableRange<float> conflicts with setNumDecimalPlacesToDisplay

If I attache parameter to slider, like that:
attachement = new APVTS::SliderAttachment(processor.myParams, myParameterID, mySlider);

Then no matter what I set in:
I always get text box precission like I set it in NormalisableRange<float>( minVal, maxVal, sliderStep ).

It would be great but the problem is that in NormalisableRange<float> it works only for:
NormalisableRange<float>( minVal, maxVal, 1 );
NormalisableRange<float>( minVal, maxVal, 0.1f );
NormalisableRange<float>( minVal, maxVal, 0.01f );

But if I want more decimal places like 0.001 or 0.00001 I always get only two decimal places like for 0.01f

How to fix that. For any help thanks in advance.

1 Like

Once you use a SliderAttachment with your slider, the textbox of your slider uses the valueToTextFunction of your AudioParameter. You can either define that function to your liking, or as a quick fix set your slider’s textFromValueFunction to nullptr like:

mySlider.textFromValueFunction = nullptr;

Then both setTextValueSuffix andsetNumDecimalPlacesToDisplay` will work.


Great thanks

This helped me too, thank you!