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) { void CrystalizerEQAudioProcessor::getStateInformation(juce::MemoryBlock &destData) {
// You should use this method to store your parameters in the memory block. auto state = apvts.copyState();
// You could do that either as raw data, or use the XML or ValueTree classes std::unique_ptr<juce::XmlElement> xml(state.createXml());
// as intermediaries to make it easy to save and load complex data. copyXmlToBinary(*xml, destData);
} }
void CrystalizerEQAudioProcessor::setStateInformation(const void *data, int sizeInBytes) { void CrystalizerEQAudioProcessor::setStateInformation(const void *data, int sizeInBytes) {
// You should use this method to restore your parameters from this memory block, std::unique_ptr<juce::XmlElement> xmlState(getXmlFromBinary(data, sizeInBytes));
// whose contents will have been created by the getStateInformation() call.
if (xmlState != nullptr) {
if (xmlState->hasTagName(apvts.state.getType())) {
apvts.replaceState(juce::ValueTree::fromXml(*xmlState));
}
}
} }
//============================================================================== //==============================================================================