Hi all,
I have an issue with losing decimal places when saving a preset with
xml->setAttribute
The parameters are all floats and have 7 decimal places in the editor but only 2 decimal places seem to be retrieved when the plugin is restored from being saved in the DAW.
Am I only ever hearing 2 decimal places of precision or are they not being stored and recalled correctly.
I think I want at least 3 decimal places!
The relevant parts of the code are below I think !
Sean
juce::AudioParameterFloat* mDelayOneTimeParameter;
addParameter(mDelayOneTimeParameter = new juce::AudioParameterFloat("delay one delaytime", "Delay One Delay Time", 0.0001, MAX_DELAY_TIME, 0.001));
addParameter(mDryGainParameter = new juce::AudioParameterFloat("drygain", "Dry Gain", 0.0, 1.0 , 0.5));
addParameter(mDelayOneGainParameter = new juce::AudioParameterFloat("delayonegain", "Delay One Gain", 0.0, 1.0 , 0.5));
addParameter(mDelayOneModDepthParameter = new juce::AudioParameterFloat("delayonemodDepth", "Delay One Mod Depth", 0, 1, 0.2));
addParameter(mDelayOneModRateParameter = new juce::AudioParameterFloat("delayonemodRate", "Delay One Mod Rate", 0, 1, 0.15));
addParameter(mDelayOneFeedbackParameter = new juce::AudioParameterFloat("feedbackone", "Feedback One", 0.0, 0.98, 0.0));
void Waylomod2020v4AudioProcessor::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> xml(getXmlFromBinary(data, sizeInBytes));
if (xml.get() != nullptr && xml->hasTagName("waylomod2020"))
{
*mDryGainParameter = xml->getDoubleAttribute("drygain");
//this->setGainSlider(xml->getDoubleAttribute("drygain"));
*mDelayOneTimeParameter = xml->getDoubleAttribute("delayonetime");
void Waylomod2020v4AudioProcessor::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.
std::unique_ptr<juce::XmlElement> xml(new juce::XmlElement ("waylomod2020"));
xml->setAttribute("drygain", *mDryGainParameter);
xml->setAttribute("delayonetime", *mDelayOneTimeParameter);