Fixed bug, where the parameters are not saved on DAW restart.

This commit is contained in:
Legaeli 2025-11-27 14:12:30 +01:00
parent e239d3e955
commit 8a1db5f2f5

View File

@ -806,14 +806,19 @@ juce::AudioProcessorEditor *CrystalizerEQAudioProcessor::createEditor() {
//==============================================================================
void CrystalizerEQAudioProcessor::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.
auto state = apvts.copyState();
std::unique_ptr<juce::XmlElement> xml(state.createXml());
copyXmlToBinary(*xml, destData);
}
void CrystalizerEQAudioProcessor::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.
std::unique_ptr<juce::XmlElement> xmlState(getXmlFromBinary(data, sizeInBytes));
if (xmlState != nullptr) {
if (xmlState->hasTagName(apvts.state.getType())) {
apvts.replaceState(juce::ValueTree::fromXml(*xmlState));
}
}
}
//==============================================================================