Slider setRange() issues

Hey, I’m working on a delay plugin and I’m having issues with setting the range for my delay time slider. I’m trying to set the range using this setRange call:

timeSlider1.setRange(TIME_MIN, TIME_MAX);

With TIME_MIN and TIME_MAX being constants set to 1.0f and 5000.0f. On the UI, the parameter range displayed in the textbox is appropriate (1-5000), but when turning the knob, the max is reached within the first third of the knob range:
TimeKnob5000ms
The knob continues to turn after but the parameter stays the same:
TimeKnob5000ms2
I set the range of all my other parameter sliders in the same fashion and they don’t give me this problem. The time sliders only starting acting up when I changed TIME_MAX to 2000.0f briefly for one build. Does anyone know why I might be having this issue or some possible fixes?

in a plugin project you should never use slider methods like setValue or setRange at all. People often get that wrong, because some of the basic JUCE tutorials both on this website and on YouTube teach you to use these methods and then use the Slider listeners to update parameter values for the processor. That is not very good unfortunately, because it doesn’t make sure that the Slider is updated when a parameter change event occurs from somewhere else, like automation or MIDI learn features. that’s why the JUCE team made SliderAttachment, ButtonAttachment and the general ParameterAttachment at some point. Objects of these classes are used to automatically connect your UI widget with an AudioProcessorValueTreeState-based parameter. It prepares the widget with all the details, so you never have to manually call one of these functions and accidently get something wrong because of that

I’m actually using attachments with AudioProcessorValueTreeState parameters, I made sliderAttachments for all my parameters in PluginEditor.h and attached them to the sliders with this code:

timeSlider1Attachment = std::make_uniquejuce::AudioProcessorValueTreeState::SliderAttachment(audioProcessor.apvts, “DELAY_1_TIME”, timeSlider1);

in that case just remove all redundant function calls on the slider

I figured it out, it was super simple in the end. When I was copying and pasting code to make all the sliders I forgot to change one thing, and accidentally set the time slider range to to my filter cutoff slider parameters (1-20,000). Thanks for the help!