AudioProcessorValueTreeState Tutorial: Parameters not being recalled


I’ve followed the tutorial and even used the downloaded project and parameter changes are not being restored when the plugin is saved an re-opened. I’ve tried this in multiple hosts and can’t get it to work.

Am I not understanding something?


Well something is obviously amiss, but I doubt it’s on the JUCE side - we’ve not made any changes to AudioProcessorValueTreeState recently.

Are other plug-ins saving their state correctly, following the same procedure?


I can’t get any plugins to save using that procedure. I have to do weirdness like:

void PluginProcessor::getStateInformation (MemoryBlock& destData)
	ScopedPointer<XmlElement> xml(mState->state.createXml());	
	xml->setAttribute("Clock", mState->getParameter(paramClock)->getValue());
	xml->setAttribute("OutChan", mState->getParameter(paramOutChan)->getValue());
	xml->setAttribute("CC1Val", mState->getParameter(paramCC1Val)->getValue());	

	copyXmlToBinary(*xml, destData);

void PluginProcessor::setStateInformation (const void* data, int sizeInBytes)

ScopedPointer<XmlElement> xmlState = getXmlFromBinary(data, sizeInBytes);

if (xmlState != 0)
	if (xmlState->hasTagName(mState->state.getType()))
		mState->getParameter(paramClock)->setValue((float)xmlState->getDoubleAttribute("Clock", 1.0));
		mState->getParameter(paramOutChan)->setValue((float)xmlState->getDoubleAttribute("OutChan", 1.0));
		mState->getParameter(paramCC1Val)->setValue((float)xmlState->getDoubleAttribute("CC1Val", 1.0));



Seems not the correct thing to have to do.


This is covered at this point:

When using the AudioProcessorValueTreeState you can simply create XML from the value tree when the host wants to store the state:

void getStateInformation (MemoryBlock& destData) override
    ScopedPointer<XmlElement> xml (parameters.state.createXml());
    copyXmlToBinary (*xml, destData);

And when restoring the state you can create a value tree by converting the host data to XML then a value tree. If this is valid, then you can just assign it to the value tree inside the AudioProcessorValueTreeState object:

void setStateInformation (const void* data, int sizeInBytes) override
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    if (xmlState != nullptr)
        if (xmlState->hasTagName (parameters.state.getType()))
            parameters.state = ValueTree::fromXml (*xmlState);


Yes, I understand all that. It is NOT working currently, hence my original post. Like I said, it doesn’t even work from the tutorial project files in any host I’ve tried! I don’t know how else to state that.

There has to be some shenanigans going on within AudioProcessorValueTreeState.


Update: This seems to only fail in the latest github version. The Grapefruit release is working.

Update 2: It could be my environment? It works in all cases if I disable VST3 in the build.


Please provide more detail.

Are you using the master or develop branch from github?

If enabling/disabling VST3 is changing things, which VST SDKs are you using? The develop branch requires the latest SDK, the master branch and the last release requires the previous SDK.

What operating system, plug-in format and host are you using?

Please describe the exact procedure you go through to save and then reload, and check that it works with a non-JUCE plug-in.


Are you sure? The master branch seems to have been hotfixed to require the latest (3.6.7) VST3 SDK too with some recent commits.


You’re right, of course. I just quickly checked out the 4.3.1 tag to investigate, which is a little behind the current master.


I’ve since cleaned my build environment and with the last development branch and lastest vst SDK, I’m not getting any problems.

At this point, I’ll have to assume it had something to do with my environment.

Thanks for all the guidance.


Can you elaborate by what you mean by cleaned your build environment? I’m having this problem as well after updating to JUCE 5 and the latest VST SDK.


In my case, I simply removed the latest 4.3.x that I was using from GitHub and removed all VST SDK’s prior to 3.66. I then download the Grapefruit release and it started working.

I just tried again with Juce 5 and It is working here with the 3.66 sdk version.