Examples/tips for ValueTree in a plugin

Hello everyone,

Are there any examples around of using a ValueTree in an audio plugin? I've recently discovered how awesome ValueTrees are and I want to be able to use them as my main data structure and using it for things like setting/getting plugin states, saving/loading presets from  XML, employing undo management, and whatever else I can do with them really. They seem like a really nice way to handle data. 

Thanks to the book Getting Started with JUCE, I can use them in a basic fashion in a GUI app, but working with plugins is a bit different and I'm not really sure of how I can use them.

I wish I had some specefic questions to ask about using them, but I'm really not sure how I should use them at all really. That's kind of why I'd like to see some examples so I can get an idea of how they can be used in the context of a plugin and its parameters and any other data that needs to be stored. 

Do any of yall have any open source apps or code you don't mind sharing? Or know of any that uses ValueTree? If not, would you mind sharing any tips for basic ways of using them? I feel like even just an example of using one to store values from a few components (maybe slider and button) would be enough to give me an idea of how it can be used.

I appreciate any replies on this subject. I'm really curious about using ValueTrees and would love to get a good starting point for using them in a plugin. They seem so awesome! In the mean time, I'll keep messing around with them in example GUI apps to get myself more familiar, but I'm an audio guy and need to figure it out for plugins sooner or later. 

Dear Jordan

I recommend you to start with simple test. Just make ValueTree and add each function. I also changed my datatable based on ValueTree, and it helps a lot!


valueTree = new ValueTree(“Channel1”);
valueTree->addListener(this);
valueTree->setProperty(“Gain”, 0, undoManager);
valueTree->setProperty(“Reverb”, 0, undoManager);

Value valueTreeObj = valueTree->getPropertyAsValue("Gain", undoManager);
slider->getValueObject().referTo(valueTreeObj);
Value valueTreeObj2 = valueTree->getPropertyAsValue("Reverb", undoManager);
slider2->getValueObject().referTo(valueTreeObj2);

A few points I got

  • ValueTree support Undo Manager: Be able to undo with short key(User think ‘undo’ should be supports!)
  • Each ValueTree can be thought as Track. The Track ValueTree can get Channel(mono->unique one child, stereo->two, …)
  • Each Channel can have related parameters in NameValueSet(Key-Value)
  • NameValueSet operates dynamically, you can set/get any type you want
    name: string(identifier), value: value
  • NameValueSet change makes event

and so other many things.

I am also construct my one, so I can give you sufficient help now.

I guess, if you leave specific technical issue, many others can respond your question.

Alan