Juce and file saving

What about a GUI sequencer with no audio component, but with connectivity via MIDI / OSC / VST? Would that have two threads as well?


I have a follow up question to number 4, as I think I still don’t understand things well enough.

The question is: what is the best & most efficient way of accessing a node that is several layers down?

Let’s say that I have a ValueTree structure that models the following XML:

<root>
<node uniqueID = "0">
</node>
<node uniqueID = "1">
	<node uniqueID = "1.0">
		<node uniqueID = "1.0.0">
		</node>
	</node>
</node>
<node uniqueID = "2">
</node>
</root>

How would I access node 1.0.0? I can see two ways:
A: root.getChild(1).getChild(0).getchild(0)
B: root.getChildWithProperty("uniqueID", "1.0.0")

A seems far too clunky. Am I right that B will take advantage of Identifier matching and will therefore be fast enough for rapid data access? Is the approach of defining a unique ID for each node misguided? Is there a better way to access specific nodes?

Please note that I haven’t actually run any of this code and it may be full of all sorts of mistakes. Please point them out if you see them, but remember that I’m not currently trying to debug, but rather to get a better understanding of how I can use ValueTrees.

I really appreciate your help here. I’ve really never done anything this complicated before, but I’m determined that I’ll master it one day!

I would advise against getChildWithProperty(), since it will traverse the whole tree to lookup the leaf.
Usually your tree reflects a hierarchy, that you follow in the lookup. If you give your nodes names of your actual data model, you will easier recognise this.
Ideally just try it out and get your hands dirty. It is easier to understand by trying your ideas out.

I see. So would it be any better to give each node a unique type/name and then use getChildWithName() (example below)? Or would this run into the same difficulties as getChildWithProperties()?

You’re right that I’ll learn by doing; this is my last question!

 <node0>
 </node0>
 <node1>
   <node1.0>
	  <node1.0.0>
	  </node1.0.0>
   </node1.0>
</node1>
<node2>
</node2>
</root>

getChildWithName("node1.0.0")

I just realized that using either of the getChildWith... methods is flawed because you will always need to construct an Identifier in order to perform the search. So it seems that the only fast / safe way to do it is using getChild() using int indexes. Is that right?