I have been following this tutorial:
At 1:27:00 he shows how to save state and load it. Works fine for him, I copy it and it doesn’t work for me. I have no idea why, tried to see if it was working with FL studio instead of AudioPluginHost but it didn’t. It’s building fine, there are no errors.
I’m just confused as to why it would work for him and not for me, could it be an issue because of the differents versions of Juce? I am using Juce8 while he’s on Juce6.
void SimpleEQAudioProcessor::getStateInformation (juce::MemoryBlock& destData)
{
// You should use this method to store your parameters in the memory block.
// You could do that either as raw data, or use the XML or ValueTree classes
// as intermediaries to make it easy to save and load complex data.
juce::MemoryOutputStream mos(destData, true);
apvts.state.writeToStream(mos);
}
void SimpleEQAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
// You should use this method to restore your parameters from this memory block,
// whose contents will have been created by the getStateInformation() call.
auto tree = juce::ValueTree::readFromData(data, sizeInBytes);
if(tree.isValid())
{
apvts.replaceState(tree);
updateFilters();
}
}
Code in question.
