Ideally don’t solve this in the slider but the parameter. Otherwise the user is able to set illegal values from the automation, control surfaces or the hosts generic parameter controls.
I found the easiest is to connect the slider using AudioProcessorValueTreeState and its SliderAttachment. That makes sure to keep the settings synchronised, including range, step size, snapToValue, skew and textToValue/valueToText.
When you create the AudioParameterFloat for the delay parameter, use the constructor that takes a NormalisableRange<float> as argument. So follow the docs to NormalisableRange to learn, what options for snapToValue you have.
The snapToValue is a callback, i.e. you don’t call the function, but you provide the logic, so the system can call it. Back then, when the Slider was written, you did that by overriding the snapToValue() method, but nowadays using lambdas is a much more convenient way.
Here an example, I’ll write it step by step, but you can probably write it more condensed:
NormalisableRange<float> range (0.1f,
1.0f,
[](auto rangeStart, auto rangeEnd, auto valueToRemap) // maps real value to 0..1
{ return jmap (valueToRemap, rangeStart, rangeEnd); },
[](auto rangeStart, auto rangeEnd, auto valueToRemap) // maps 0..1 values to real world
{ return jmap (valueToRemap, rangeStart, rangeEnd, 0.0f, 1.0f); },
[](auto rangeStart, auto rangeEnd, auto valueToRemap) // maps real world to legal real world
{
return jlimit (rangeStart, rangeEnd,
0.1f * roundToInt (valueToRemap * 10.0f)); // e.g. make sure, only one digit after comma
});
// creating the parameter:
std::make_unique<AudioParameterFloat>("delay", "Delay", range, 0.1f);
Hope that helps