Hi, I am working on a plugin and have a problem where the parameters reset when the plugin GUI is closed and reopened. I realized this is because I am setting the values of the sliders in the GUI constructor.
What is the standard method for setting plugin parameters / slider values in order to avoid this?
I was thinking I could have the slider values saved as variables in the plugin processor object and have the GUI set the slider values from those, but I wanted to ask what the best practice was for doing this.
You answered it yourself. When you create the gui, you read the values from the processor, instead of using a gui defined default.
Don’t forget, the processor has to be valid completely without the gui. If you have a project with many plugins, usually you have only a couple of them open, most of them run without having the gui open.
To make it absolutely clear, you should not use the processor to just “deposit” the value of the slider when you close the editor, only to retrieve it later when you open it again.
The current value of the parameter should live at all times in the processor.
The Slider is merely a visualization of it: when you drag the Slider, you update the value in the processor, and if the value changes in the processor, you should update the position of the slider accordingly.
When things are laid out that way, you don’t need to take any action when closing the editor, and when opening it you just need to read the current value of the parameters from the processor and update the positions of the sliders accordingly
Hello, could you please check that plugin generated faust2juce command. There are two sliders, but one resets after GUI close-open, and one(Gain) saving state and not resets. movingelements2.zip (86.1 KB)