KeyBus, NamedBus


keep control values organised by name and synced between client and server.


Server.default = s = Server.internal.boot; 


// make a keybus

v = KeyBus([\a, \b, \c, \d, \e], [0, 1, 2, 3, [5, 6, 7, 8, 9]] * 0.1);

v.bus

v.keys

v.values

v.bus.scope;


// set values by name

v.set(\a, 0.9);

v.set(\a, 0.9, \d, -0.8);

v.set(\a, 0.9, \e, [1, 1, 1, 0, 1]); // fine

v.set(\a, 0.9, \e, 0 ! 5);

v.set(\a, 0.9, \e, -0.8); // fails - \e must be array

v.set(\a, 0.0, \xyz, -0.0); // bad name, fails


// get current values back from server

v.get(\a);

v.get(\a, \e, \d);

v.get(\a, \e, \d, \xyz); // fails


// same thing with access to namedbus object by name, Tdef/Pdef/Ndef-like. 

 

NamedBus(\test, [\a, \b, \c, \d, \e], [0, 1, 2, 3, 4] * 0.1) 

v = NamedBus(\test).dump

v.dump;

v.values;

v.keys;


// setByIndex : only works for busses with all equal sizes.

u = KeyBus([\a, \b, \c, \d, \e], [0, 1, 2, 3, 4] * 0.1);

d = VGSpecEditor(u);

u.values;

u.setByIndex(0, \freq, 1); // warn and ignore


v = KeyBus([\freq, \amp, \ringtime, \attack], [[330, 440], [0.2, 0.1], [3, 2], [0.01, 0.03]]);


v = KeyBus([\freq, \amp, \ringtime, \attack], [[330, 440], [0.2, 0.1], [3, 2], [0.01, 0.03]]);



e = VGSpecEditor(v);

e = VGSpecEditor(v, top: true);

e = VGSpecEditor(v, top: true, slide: true);

e = VGSpecEditor(v, top: true, slide: true, buttons: true);

e = VGSpecEditor(v, top: true, slide: true, buttons: true, pop: true);

e = VGSpecEditor(v, top: true, slide: true, buttons: true, pop: true, buttonsWidth: 120);

e = VGSpecEditor(v, top: true, slide: true, buttons: true, pop: true, indexToSet: 2, buttonsWidth: 120);



v = KeyBus([\freq, \amp, \ringtime, \attack], [[330, 440], [0.2, 0.1], [3, 2], [0.01, 0.03]]);


e.dump;

e.editors.first.comp.bounds;


v.setByIndex(0, \freq, 666); v.values;

v.setByIndex(1, \freq, 888); v.values;

v.setByIndex(0,  \amp, 0.3); v.values;

v.setByIndex(1,  \freq, 765, \amp, 0.1234, \ringtime, 1); v.values;

v.setByIndex(1,  \nixinix); v.values; // ignored, no warning


VGSpecEditor


// Usage: 

NamedBus(\global, [\freq, \amp, \ring, \attack], [1,1,1,1]); 

NamedBus(\PekingA, [\freq, \amp, \ring, \attack], [1,1,1,1]);

// bus for ein intrument mit 2 

NamedBus(\gamKUG_Sl_PekingA_61, [\freq, \amp, \ring, \attack, \freqs, \rings, \amps], 

[1,1,1,1, [1, 1], [1, 1], [1, 1]]); // 2 partials


// not yet

NamedBus(\global).set(*[[\freq, \amp, \ring, \attack], [1,1,1,1]].flop); 



VGReson.loadSpecData;

VGReson.allSpecs['Sl_DemungA_43'].postcs


VGSampGui.new