Slider UI 'glitching' on front-end update

gui

#1

Hi there, I’m somewhat new to JUCE but have a UI Component problem with my plugin that’s been puzzling me especially since I’ve been successful in implementing parameter->UI/UI->parameter updates elsewhere in my plugin.

Description:
In my PluginProcessor I have an array of delayParameters[8] and an array of panParameters[8]. In my editor I have an array of sliders, delayS[8] and panS[8]. (These of course each correspond to the parameters in my processor.

In order to update the parameters from a Slider event I have a Listener function sliderValueChanged that updates these parameters:

void editor::sliderValueChanged (Slider *slider)
{
for( int i = 0; i<8; i++){
    if (slider == &delayS[i]){
        processor.delayParameters[i]->setValueNotifyingHost((float) delayS[i].getValue());
    }
    
    if (slider == &panS[i]){
        processor.panParameters[i]->setValueNotifyingHost((float) panS[i].getValue());
    }
}

}

To update the sliders from a parameter change I’m using a timerCallback method:

void NewProjectAudioProcessorEditor::timerCallback(){ 
    for(int i = 0; i<8; i++){
        delayS[i].setValue(processor.delayParameters[i]->get(), dontSendNotification);
        panS[i].setValue(processor.panParameters[i]->get(), dontSendNotification);
    }
}

[LINK]
Behavior Example

As I said, for the delay sliders/parameters this works fine, but I get the following behavior when I try updating pan parameters from the slider. The framerate is low, but notice how it seems as if the parameters are overriding the slider. Something seems wrong with the value exchange, but I’m doing nothing different to how I setup my sliders.

Potentially helpful info:
For my timer callback function I call
startTimer(30); at the start of the editor constructor.

This is how I am setting up my array of sliders

for(int i = 0; i< 8; i++){ //for each slider
    delayS[i].setSliderStyle (Slider::LinearBarVertical);
    delayS[i].setRange(0.0, 1.0, 0.01);
    delayS[i].setTextBoxStyle (Slider::NoTextBox, false, 90, 0);
    delayS[i].setPopupDisplayEnabled (true, this);
    delayS[i].setTextValueSuffix (" Delay Wet");
    delayS[i].setValue(p.delayParameters[i]->get());
    mt.getTabContentComponent(0)->addAndMakeVisible(&delayS[i]);
    delayS[i].addListener(this);
    delayS[i].setLookAndFeel (&laf2);

    panS[i].setSliderStyle (Slider::LinearBarVertical);
    panS[i].setRange (-1.0, 1.0, 0.01);
    panS[i].setTextBoxStyle (Slider::NoTextBox, false, 90, 0);
    panS[i].setPopupDisplayEnabled (true, this);
    panS[i].setTextValueSuffix (" Pan");
    panS[i].setValue(p.panParameters[i]->get());
    mt.getTabContentComponent(1)->addAndMakeVisible(&panS[i]);
    panS[i].addListener(this);
    panS[i].setLookAndFeel (&laf2);

}


#2

Hi there,

My knee-jerk reaction is that it could be a range normalisation issue: your delay value range is 0 to 1 (which you say works) whereas the pan range is -1 to 1, which is twice as wide and goes negative. Plug-in parameters are typically expressed in terms of a 0 to 1 range, so a simple conversion for your pans when updating the parameter should solve this… I hope. Good luck! :slight_smile:


#3

Well that certainly fixed it. Thanks so much!

Is there no way to slide between other ranges? Going form 0-1 seems to work fine, but if I set the ranges on my parameters and sliders to say, 0-2 or 10-22000, the error returns. If not, I’ll certainly just scale the values to what I need them to be, but it seems odd not to be able to have my parameters as anything other than (0-1)


#4

You’re welcome. I’m glad that worked!

Feel free to use any ranges you like for your parameters, but internally they are always stored as 0-1 so you will need the simple conversion step for anything other than the default.