2 summary:: set a nodeproxy's vol conditionally
3 categories:: Libraries>JITLib>GUI
4 related:: Reference/softSet, Reference/softPut
7 Extension method to link::Classes/NodeProxy:: to set vol conditionally.
13 the volume value to set to
15 the normalized range within which the set is accepted
17 a flag whether to pause the nodeproxy when volume is 0.
18 waits for 0.2 seconds for volume to go down first.
20 the previous value that the controller has set - can be
22 a link::Classes/ControlSpec:: can be passed in. if nil, code::\amp.asSpec:: is used.
26 Ndef(\test, { |freq=200| Splay.ar(SinOsc.ar(freq * Array.rand(12, 0.95, 1.05))) });
27 Ndef(\test).play(vol: 0.1);
29 // example of softSet, softSet which knows lastVal,
30 // softVol_ and softVol_ which knows lastVol:
32 w = Window("softVol", Rect(500, 200, 400, 240)).front;
34 NdefGui(Ndef(\test), 2, w);
36 // same for volume - not too safe
37 EZSlider(w, 340@30, \softVol, \amp, { |sl|
38 Ndef(\test).softVol_(sl.value, 0.05)
41 EZSlider(w, 340@30, \knowLastV, \amp, Routine { |sl|
45 Ndef(\test).softVol_(sl.value, 0.05, lastVal: lastVal);