/*

VGMulTree easy to use multiplication tree for synth parameters


*new(specs, branches, baseSpecs)

specs is a dictionary of local spec values (e.g. freqRatio, ringRatio, ampRatio)

branches is a dictionary of more VGMulTrees

baseSpecs is a repository of reference values (can be nil)



*/

(

a = VGMulTree.newFromDict((

argNames: [\freq, \amp],

specs: [0.9, 0.9], 

relSpecs: [1, 1], 

baseSpecs: [440, 0.5]

));

)


(


a = VGMulTree.newFromDict((

argNames: [\freq, \amp],

specs: [0.9, 0.9] , 

branches: (

boing: (

specs: [1, 1] * 1.2, 

branches: 

(

\1: (

specs: [1, 1], 

relSpecs: [[1, 1], [1, 1] * 1.3], 

baseSpecs: [[440, 870], [0.3, 0.2]]), 

\2: (

specs: [1, 1], 

relSpecs: [[1, 1], [1, 1] * 1.3], 

baseSpecs: [[660], [0.1]])

)

)

)

));

)

a.mulBus.values

a.branches


a.nodeAt();

a.nodeAt( \boing);

a.nodeAt(\boing, \1).baseValues;

a.nodeAt(\boing, \2).baseValues;


a.calcAt(\boing, \2);

a.calcAtLeaf(\boing, \2);

a.calcAtLeaf(\boing, \1);


a.collectNodes([\boing, \2]).collect({ |node| node.mulBus.values });


a.nodeAt(\boing).set(\freq, 1.5);


a.nodeAt(\boing);


a.collectNodes([\boing, \2])

a.collectNodes([\boing, \1])

a.bussesFor([\boing], [\ebus, \ibus], false);

a.bussesFor([\boing], [\ebus, \ibus]); // should fail

a.bussesFor([\boing, \2], [\ebus, \ibus]); // should fail

a.bussesFor([\boing, \2], [\ebus, \ibus, \sbus, \pbus, \bbus]); // OK

a.bussesFor([\boing, \1], [\ebus, \ibus, \sbus, \pbus], false); // OK



a.deepDo { |x| x.postln };