2 summary:: a gui for a NodeProxy or Ndef
3 categories:: Libraries>JITLib>GUI
4 related:: Classes/MonitorGui, Classes/NdefParamGui, Classes/NdefMixer, Classes/ProxyMixer
8 NdefGui provides controls for handling and editing a link::Classes/NodeProxy:: or link::Classes/Ndef::, and its monitors. NdefGui replaces link::Classes/NodeProxyEditor::. It provides:
11 ## sliders for numerical settings
12 ## mapping of kr proxies to parameters
13 ## optional controls for playing / monitoring
16 Both link::Classes/NodeProxy:: and link::Classes/Ndef:: implement a strong::.gui:: message, which returns a NdefGui for that NodeProxy. Overview: link::Overviews/JITLib::.
27 the nodeproxy to be shown and edited, or nil.
30 How many sliders or textviews for paramaters to provide. Default value is 0.
33 a parent view where NdefGui is to be shown. If nil, a window is made.
36 bounds where the view (or window) will be shown.
39 a flag whether to create and start a link::Classes/SkipJack:: for auto-updating.
42 an array of symbols for options of what to display. See list below.
44 subsection::Class Variables
47 a dict for the sizes of the different gui elements.
51 subsection::Instance Variables
53 ... object, numItems, parent, bounds ...
54 ... zone, minSize, defPos, skin, font, skipjack ...
56 method::nameView, typeView, monitorGui, paramGui, fadeBox, pauseBut, sendBut, edBut
57 Views if they were present in the options.
62 // some preparation - make an ar and a kr nodeproxy.
65 Ndef(\lfo, { |lofreq| SinOsc.kr(lofreq) });
66 Ndef(\a, { |freq=300, dens=20, amp=0.1, pan|
67 Pan2.ar(Ringz.ar(Dust.ar(dens, amp / (dens.max(1).sqrt)), freq, 0.2), pan)
71 // make an NdefGui. By default, this has a lot of the options on.
73 n.object_(Ndef(\lfo));
76 Ndef(\a).set(\lofreq, 12);
79 subsection::Some configuration options
82 // numItems - sliders for setting parameters
83 n = NdefGui(Ndef(\a), 8);
85 // 4 sets of configurations are provided:
86 n = NdefGui(Ndef(\a), 0, options: NdefGui.control);
87 n = NdefGui(Ndef(\a), 0, options: NdefGui.audio);
88 n = NdefGui(Ndef(\a), 0, options: NdefGui.big);
89 n = NdefGui(Ndef(\a), 0, options: NdefGui.full);
92 NdefGui.control; // used for control proxies in PxMix
93 -> [ \name, \pausR, \sendR, \poll, \ed ]
95 NdefGui.audio; // used for audio proxies in PxMix
96 -> [ \monitor, \playN, \name, \pausR, \sendR, \ed ]
98 NdefGui.big; // used for the big NdefGui in PxMix
99 -> [ \name, \type, \CLR, \reset, \scope, \doc, \end, \fade,
100 \monitor, \playN, \pausR, \sendR, \poll ]
104 -> [ name, \type, \CLR, \reset, \scope, \doc, \end, \fade, \rip,
105 monitor, \playN, \pausR, \sendR, \poll, \ed ]
107 // the choice of elements is
108 \name a dragboth for the proxy's name
109 \type a view for the proxy's type (ir, ar + numChans, kr + numChans)
110 \CLR button to clear proxy
111 \reset button to reset proxy nodemap
112 \scope button to scope proxy
113 \doc button to document proxy as code
114 \end button to end proxy
115 \fade EZNumber for setting proxy fadetime
117 \monitor MonitorGui for audio proxies
118 \playN a button for editing playN settings (within the MonitorGui)
120 \rip (^) button to open a new editor on the proxy (used in PxMix)
122 \pausR a button to toggle proxy pause/resume
123 \sendR a button to re-send; alt-click tells the proxy to rebuild
126 // Planned options - not done yet:
127 \morph add a PxPreset / morph control
129 // pass in functions to add your own elements, such as:
130 \zoink -> { |ndgui| Button(ndgui.zone, 60@20).states_([["zoink"]]).action_({ ndgui.object.zoink }) };
134 // make one and watch how the elements change
135 n = NdefGui(Ndef(\a), 4, options: NdefGui.big);
142 Ndef(\a).playN([2, 5]);
143 Ndef(\a).playN([2, 5], vol: 0.34);
146 // as in ProxyMixer, left side
147 n = NdefGui(Ndef(\a), options: NdefGui.audio);
148 n = NdefGui(Ndef(\a), 4, options: NdefGui.control); // control zone
149 n = NdefGui(options: NdefGui.big);
151 n = NdefGui(bounds: 400@20, options: NdefGui.full);
153 // put in a window - then no margin is added
157 n = NdefGui(Ndef(\a), 4, w, options: NdefGui.big);
161 Ndef(\a, { |freq = 10| Blip.ar(freq) }).set(\freq, 200)
162 Ndef(\a, { |freq = 10, amp = 0.1| Blip.ar(freq) * amp })
163 Ndef(\a).set(\freq, 220)
164 Ndef(\a).set(\harm, 20)
165 Ndef(\a, { |freq = 10, amp = 0.1, harm = 20| Blip.ar(freq, harm) * amp })
168 subsection::Works with ProxySpace as well
172 n = NdefGui(~test, 4);
177 // too many controls: an EZScroller helps.
179 ~test = { |freq=300, dens=20, amp=0.1, pan, ping=12, tok=13, crak|
180 Pan2.ar(Ringz.ar(Dust.ar(dens, amp / (dens.max(1).sqrt)), freq, 0.2), pan)
182 // gets specs for slider ranges from global lookup in Spec.specs:
183 Spec.add(\dens, [0.1, 100, \exp, 0.01, 10]);
186 ( // keys go away if not needed
187 ~test = { |freq=300, dens=20, amp=0.1|
188 Pan2.ar(Ringz.ar(Dust.ar(dens, amp / (dens.max(1).sqrt)), freq, 0.2))
192 ( // and are added in order if needed
193 ~test = { |freq=300, intv=0, dens=20, amp=0.1, pan, pok, ting|
196 Dust.ar(dens ! 2, amp / (dens.max(1).sqrt)),
197 freq * [intv, intv.neg].midiratio, 0.2))
201 // changes in settings are shown:
202 ~test.set(\freq, exprand(100.0, 2000.0));
205 // mapping kr proxies to controls is shown
206 ~lfo = { LFNoise0.kr(8, 4) };
207 ~test.map(\intv, ~lfo);
210 Spec.add(\intv, ControlSpec(0, 24, \lin, 0.01, 0));
211 // setting a param value unmaps a previous control source
212 ~test.set(\freq, rrand(200, 500), \intv, rrand(-5.5, 5.5));
215 subsection::You can drag and drop proxies between NodeProxyEditors
219 // p = ProxySpace.push(s.boot);
221 l = NdefGui(nil, 3).moveTo(10, 120);
222 m = NdefGui(nil, 3).moveTo(10, 240);
223 n = NdefGui(nil, 3).moveTo(10, 360);
224 o = NdefGui(nil, 3).moveTo(10, 480);
226 Spec.add(\dens, [0.1, 300, \exp]);
228 // make 3 kinds of proxies: using tilde/proxyspace, Ndef, and unnamed.
229 ~spacy = {|dens=5| Formlet.ar(Dust.ar(dens ! 2), LFDNoise0.kr(20 ! 2).lag(0.1).linexp(-1, 1, 300, 5000), 0.003, 0.03) };
230 Ndef(\ndeffy, { GrayNoise.ar( 0.1 ! 2) });
231 c = NodeProxy.audio.source_({ PinkNoise.ar(0.1 ! 2) });
233 // put one in each editor
235 m.object_(Ndef(\ndeffy));
238 // one can also drag and drop text into the drag:
242 subsection::test replacing keys - needed for ProxyChain
246 Ndef(\a, { |freq=300, dens=20, amp=0.1, pan|
247 Pan2.ar(Ringz.ar(Dust.ar(dens, amp / (dens.max(1).sqrt)), freq, 0.2), pan)
249 n = NdefGui(Ndef(\a));
251 n.addReplaceKey(\freq, \myFreak);
252 // ATM needs an extra update:
253 x = n.object; n.object_(nil); n.object_(x);