Slider increment interval not working, how to set range to snap to integer in GUI?

Hi all, I have set my slider range as so:

 datasetSelectionSlider.setRange(1.0, 3.0, 1.0);

Hoping this would snap the result to an integer. This does not happen in the GUI when using the plugin, why is this? State is managed using processor value tree state, where my atomic pointer is of type audioParamterFloat, and this is the tree state parameter.

std::make_unique<juce::AudioParameterFloat> (juce::ParameterID("datasetSelection", 1), "Dataset Selection", 1.0, 3.0, 1.0)

Do I need to update this AudioParamterFloat in some way?
I know this must be a trivial issue, but I do not know the trick, many thanks!

If you are using an AudioParameterValueTreeState, then

AudioProcessorValueTreeStateParameterAttributes Class includes withDiscrete

1 Like

Thank you very much! And this will result in a visual ‘snap’ to the desired value in the GUI?

It should do what you want, with both the GUI and the automation lane.