Thanks so much for the help so far! I’ve managed to completely replace my Array of Points with a ValueTree containing child trees which have x and y values as properties, and my code is all working exactly as it was with the Array.
I’m still having issues with saving and loading though, each time I load up a new instance of my plugin, I can move around my points, save it, then reload the project and it will recall the points as it was when it was saved. However any time after that, reloading the plugin will only reload the points as they were when it was saved for the first time. I must be doing something right for it to save the first time, but it only ever uses that first saved state from then on.
Here are my getStateInformation and setStateInformation functions, where parameters is my AudioProcessorValueTreeState, and pointTree is my ValueTree of points:
void TestProjectAudioProcessor::getStateInformation (MemoryBlock& destData)
ScopedPointer <XmlElement> xml (parameters.state.createXml());
void TestProjectAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
ScopedPointer<XmlElement> xmlState (getXmlFromBinary(data, sizeInBytes));
if (xmlState.get() != nullptr)
if (xmlState -> hasTagName(parameters.state.getType()))
XmlElement* points (xmlState->getChildByName("pointTree"));
if (points != nullptr)
ValueTree point ("point");
point.setProperty("x", each->getDoubleAttribute("x"), nullptr);
point.setProperty("y", each->getDoubleAttribute("y"), nullptr);