Why ValueTreeState don`t save parameters?

Hello, maybe I don`t understand simple things, but I wrote the saving of parameters in the usual way using AudioProcessorValueTreeState and XmlElement. However, the state of my plugin is not saved, and when it is included in the host, no signal passes through it until I move the volume sliders. Tell me if everything is ok with these classes or am I doing something wrong? Maybe exist something another path for solution the problem?

Can you post some code, so I can give it a look?

Yes, Ill give you all code. Actually it is simple compressor, Im trying to make base things. Link to GitHub: https://github.com/CupaState/compCode.git

Probably a private repository? The link cannot be opened…

Sorry, its private repository. Ill append zip-archivecompCode-developTwo.zip (185.9 KB)

The reason why you don’t hear anything until you move the gain slider is because you are applying the gain linearly, not in dB.

On line 222 of PluginProcessor.cpp use:

buffer.applyGain(Decibels::decibelsToGain(pOverallGain));

On line 125 of Compressor.cpp use:

this->mMakeUpGain = Decibels::decibelsToGain(makeUpGain);

Regarding the parameters recall problem, I recommend following this tutorial: https://docs.juce.com/master/tutorial_audio_processor_value_tree_state.html

You should hook up your SliderAttachment variable like what is done in the tutorial. This will automatically update your parameters with your GUI. Also, having a parameter and a separate variable that represents the same thing is redundant because you can just use the parameter in the first place. For instance, you have float pThreshold and thresholdParam. You should turn your parameters into DevilPumperInfinityAudioProcessor members, and then just simply use them for updating your compressor values.

Thank you, Jamand. As for your advice about decibelsToGain() - it works. But about ValueTreeState: I did everything as shown in the tutorial, but it didn’t work. I have almost completely rewritten PluginProcessor. but it still doesn’t work. I’m running out of options for what I can do. Perhaps there is some other way to save the plugin state without using ValueTreeState?