So total beginner here with C++ and JUCE. I have been following a Kadenze course to help walk me through how to develop an audio plugin. Unfortunately this course is pretty outdated and I’ve had to teach myself a good chunk of it. I am getting error when I try to write and restore my parameters from the memory block. Below is what my current SetState and GetState functions look like.
Can anyone advise on some possible solutions for this? I did find another thread that may address the issue, but as a beginner I haven’t been able to figure out the steps to resolve my issue.
Looks like you’ve got a double deletion going on in getStateInformation(). This line is the culprit:
preset.addChildElement (presetBody.get());
The XmlElement class automatically deletes child nodes when their parent object is deleted, so you have to transfer ownership of any child nodes that are added. Since you’re using a unique_ptr, you can do this by using release() instead of get() in the addChildElement() call: