Hi there,
Let’s say I have an apvts with two parameters added:
std::make_unique<juce::AudioParameterFloat> (ParameterID("gain", 1), "Gain", 0.0f, 1.0f, 0.5f),
std::make_unique<juce::AudioParameterBool> (ParameterID("invertPhase", 1), "Invert Phase", false)
If I assign a new state to the apvts (such as in setStateInformation
), my expectation was that the apvts synchronizes with parameters and adds any PARAM children to the ValueTree that might be missing.
It seems that the children are added, but with no value
property. So the apvts ValueTree ends up in a surprising “half existing” state.
To reproduce:
ValueTree mockIncomingState { "incoming" };
mockIncomingState.copyPropertiesAndChildrenFrom(parameters.state, nullptr);
mockIncomingState.removeChild(1, nullptr); // remove the boolean "invert phase" parameter
parameters.state = mockIncomingState; // copy to apvts
jassert(parameters.state.getChild(1).hasProperty("id"));
jassert(parameters.state.getChild(1).hasProperty("value"));
An assertion happens on the last line. Is this a bug, or is there an incantation I’m missing to get the value
to populate?