Using JSON or XML to manage parameters


#1

Hi there,
I’d like to speed up development a bit and thought about using JSON or XML to define my parameters. Can someone head me in the right direction? I’m happily using AudioProcessorValueTreeState to manage parameters, but how can I parse my parameters from a file at compile time?
Thanks!
p.s. I’m interested in best practice to manage 50+ parameters in general, so if you are up to sharing your workflows, I’d appreciate it as well


#2

The ValueTree class has a fromXML() method that might be of some use?


#3

yes, that’s true but I also want to create some StringArrays for parameterIDs and parameterNames so I can iterate through those - or is there a way to do that with a ValueTree?


#4

A ValueTree can hold array objects which you can easily iterate through. But once you load arrays into a value tree you can forget about accessing the xml utility methods as they will no longer work.


#5

hm… I was thinking about a generic parameter system so I can just create my parameters using XML or JSON and construct everything I need from that (AudioProcessorValueTree, StringArrays, etc.) - thanks anyway so far :slight_smile:


#6

BUT the fact that the ValueTree can hold arrays is actually a nice way to store my data! I’m using JSON now to manage my parameters (this is so much better than doing everything in code and I like the formatting more than XML), then I parse them into my ValueTree, create my StringArrays etc. and save everything in the ValueTree again. Sweet!