Plugin state resetting

probably a simple fix, i have a simple soft clipper plugin that works perfectly. Except for the fact that when i close the plugin in my DAW and re-open the same instance the values have reset back to default.

It’s probably a really simple fix but i appreciate any comments! cheers.

Example;

  • adds plugin to my fx chain.
  • changes threshold from 0 to -6.
  • closes plugin to continue working.
  • reopens plugin (for whatever reason)
  • threshold resets itself from -6 to 0.

What do you do in your setStateInformation / getStateInformation callbacks? This is the place where the DAW asks the plugin to serialise its state on session saving and to restore a state on session restoration.

When you say you close and reopen the plugin do you just mean you close the GUI? In which case I don’t think the set/get StateInformation stuff will make any difference since the same plugin instance is still running.

Are you setting the parameter values from the GUI side (PluginEditor, etc.) when it’s opened?

It may also be that you just haven’t told your GUI widgets to update their values when the GUI is first loaded. So the actual parameter values are correct but the displayed values are wrong.

1 Like

hi, yes thanks… that is what i meant, the plugin instance is still the same i am just closing the GUI!

here is the code i’m using to change values and the like:

Adding a listener… (editor cpp)

Slider_ThresholdLevel.addListener(this);

Detecting the change with an overridden function…

void ClipperAudioProcessorEditor::sliderValueChanged(juce::Slider* control) {
        if (control == &Slider_ThresholdLevel) 
        {
            audioProcessor.thresholdLevelValue = Slider_ThresholdLevel.getValue();
        }
    }

In my processor header…

float thresholdLevelValue;

If anymore info is required please lemme know!
@ImJimmi

In most hosts, the GUI editor will be completely destroyed and recreated again when you close and reopen the GUI. So, you will need to ensure your GUI keeps track of the parameter values in the AudioProcessor. Instead of manually handling the parameter states (with sliderValueChanged etc), you might want to look into using the AudioProcessorValueTreeState and the parameter attachments for the editor components.

1 Like

great! thanks very much

I had this exact same problem, and it turned out that in my editor, I had created all my components with initial values. Make sure that in your editor’s constructor, if you’re initializing the values of any sliders or anything like that, do it by polling processor->parameter->get() instead of assigning it to an arbitrary value