Hi,
I’m playing around with the examples from David Rowland - Using JUCE value trees and modern C++ to build large scale applications (ADC’17). I’ve create a ModulatorList
class which inherits from Davids ValueTreeObjectList
. The code example below shows the constructor of the Plug-In, where I’m adding two new modulators to the tree. The DBG(apvts_.state.toXmlString());
statement correctly prints a XML document with 2 modulators added.
If I do the same statement inside my editor constructor: DBG(processor.GetState().state.toXmlString());
it only prints the main identifier & the plug-in parameters added via the ParameterLayout
. The added modulators are no longer visible.
Any ideas how this could happen?
Processor
class AudioPlugin
{
public:
AudioPlugin()
: state_(*this, &undoManager_, "AudioPlugin",
{std::make_unique<juce::AudioParameterFloat>("gain", "Gain", 0.0f, 2.0f, 1.0f)})
, modList_(apvts_.state)
{
ValueTreeUtils::CreateUuidProperty(apvts_.state);
apvts_.state.addChild(juce::ValueTree {ids::CONST_MODULATOR}, -1, nullptr);
apvts_.state.addChild(juce::ValueTree {ids::LFO_MODULATOR}, -1, nullptr);
jassert(modList_.objects.size() == 2);
DBG(apvts_.state.toXmlString());
}
auto GetState() -> juce::AudioProcessorValueTreeState& { return apvts_; }
auto GetState() const -> juce::AudioProcessorValueTreeState const& { return apvts_; }
// ...
private:
juce::AudioProcessorValueTreeState apvts_;
mc::ModulatorList modList_;
};
Editor
// ...
DBG(processor.GetState().state.toXmlString());
// ...