VST setStateInformation

Is setStateInformation in a plugin called before the editor is created?

In my plugin I can save and load standalone state the recommended way but when it reloads in my DAW it doesn’t seem to load state correctly and the only reason I can think of are some defaults are set in plugin editor.

the reason I do that is because some of the knobs don’t link up. I think the valuetree’s and attachments are causing me lots of problems but don’t think I’m doing anything majorly wrong.

I think you cannot know, if it happens before or after. You would expect, if it restores a session, that it happened before (immediately after creating the instance). However, e.g. with the compare button or loading a preset, it could happen during the lifetime of the editor as well.

For the ValueTree and Attachments, for me it worked the better, the less additional stuff like listeners or alike I used. Ideally the editor is completely dumb and everything is defined in the AudioProcessorParameters.

Yeah that’s what I suspected.
So my approach now is initialise the params in the processor
and when my editor is constructed us the setValueNotifyingHost but pull the value from the normalisedRange in the param.

You don’t need to do anything like that. The Attachment copies the range for you, the skew and how the texts are displayed. And it sends the correct beginChangeGesture(), setValueNotifyingHost() and endChangeGesture().
It also does the initial synchronisation from parameter to slider at the moment, you create the Attachment.

Then I must be doing something wrong as that’s what I thought it should do out the box


#ifndef JucePlugin_PreferredChannelConfigurations
     : AudioProcessor (BusesProperties()
                     #if ! JucePlugin_IsMidiEffect
                      #if ! JucePlugin_IsSynth
                       .withInput  ("Input",  AudioChannelSet::stereo(), true)
                       .withOutput ("Output", AudioChannelSet::stereo(), true)
                       ), undoManager(3000, 30), params(*this, &undoManager, "dynamics",
	std::make_unique<AudioParameterFloat>("tube_type", TRANS("Tube Type"), NormalisableRange<float>(0.0, 10, 1), mTubeType.get()),
	std::make_unique<AudioParameterFloat>("activation", TRANS("Activation"), NormalisableRange<float>(0.0, 1000, 0.1), mActivationPercent.get()),
	std::make_unique<AudioParameterFloat>("release", TRANS("Release"), NormalisableRange<float>(2.0, 1000, 0.1), mRelease.get()),
	std::make_unique<AudioParameterFloat>("threshold", TRANS("Envelope Threshold"), NormalisableRange<float>(-15.0, 6.0, 0.1), mEnvThresholdDb.get()),
	std::make_unique<AudioParameterFloat>("ceiling", TRANS("Ceiling"), NormalisableRange<float>(-15.0, 6.0, 0.1), mCeilingDb.get()),
	std::make_unique<AudioParameterFloat>("stereo_link", TRANS("Stereo Link"), NormalisableRange<float>(0, 100, 0.1), mStereoLink.get()),
	std::make_unique<AudioParameterFloat>("peak_link", TRANS("Peak Link"), NormalisableRange<float>(0.0, 100, 0.1), mPeakLink.get()),

My Plugin Editor

DynamicsAudioProcessorEditor::DynamicsAudioProcessorEditor(DynamicsAudioProcessor& p, AudioProcessorValueTreeState& vt)
	: AudioProcessorEditor(&p), processor(p), assets(std::make_shared<Assets>()), params(vt),
	controls(assets, p, vt),

And my controls.cpp where the sliders are

Controls::Controls(std::shared_ptr<Assets> _assets, DynamicsAudioProcessor& p, AudioProcessorValueTreeState& vt)

	: assets(_assets),

	releaseAttachment(vt, "release",ctrlRelease),
	envThresholdAttachment(vt, "threshold", ctrlEnvelopeThreshold),
	ceilingAttachment(vt, "ceiling", ctrlCeiling),
	peakLinkAttachment(vt, "peak_link", ctrlPeakLink),
	stereoLinkAttachment(vt, "stereo_link", ctrlStereoLink),

	ctrlSingleTube{ _assets },
	ctrlDualTube{ _assets },
	ctrlBrokenTube{ _assets }

Is it because my sliders aren’t inited in the editor. I have tried to pass the construction arguments in initialisation so thought that should work?

Yes, that is how it works for me…

What do you call on the sliders after the attachments are connected? Can you try to comment anything out, like skew, range or text suffix, and especially listeners, if there are any…

Yeah so there’s text suffixes, listeners and ranges on them all :frowning:

Ahh ok I know why you asked now. It makes sense that you define them all through the audioParameters. I think I should be able to fix