Server.local.boot.makeWindow;
(
s.boot;
( // controlspecs for its params
Spec.add(\pFreq, [2, 200, \exp]);
Spec.add(\pWidth, [0.01, 0.5, \exp]);
Ndef(\test, { |pFreq=100, pWidth=0.5| LPF.ar(LFPulse.ar(pFreq, 0, pWidth), 1500) * 0.1 });
Ndef(\test).play;
);
(
c = CtLoop(\test,
(
x: { |val| Ndef(\test).set(\pFreq, \pFreq.asSpec.map(val)) },
y: { |val| Ndef(\test).set(\pWidth, \pWidth.asSpec.map(val)) }
)
);
);
(
w = Window("record moves and play them").front;
t = Slider2D(w, Rect(0,0, 160, 160))
.action_({ |sl|
var x, y; x = sl.x; y = sl.y;
c.recordEvent(\x, x);
c.recordEvent(\y, y);
Ndef(\test).set(
\pFreq, \pFreq.asSpec.map(x),
\pWidth, \pWidth.asSpec.map(y)
);
});
);
NdefGui(Ndef(\test), 5, parent: w, bounds: Rect(0,180,400,200));
g = CtLoopGui(c, parent: w, bounds: Rect(170, 0, 220, 160));
)
// tests
c.play;
c.stop;
c.play;
c.pause;
c.resume;
c.startRec;
c.stopRec;
g.getState;
g.object = nil;
g.getState;
c.dump
c.tempo = 0.5;
(
w = Window("CtLoopGui", Rect(0, 400,220, 200)).front;
w.addFlowLayout(2@2, 0@0);
Button(w, Rect(0, 0, 80, 20)).states_([["mytest"]]);
Button(w, Rect(0, 0, 40, 20)).states_([[">"], ["_"], ["|"]]);
Button(w, Rect(0, 0, 40, 20)).states_([["paus"], ["rsum"]]);
Button(w, Rect(0, 0, 40, 20)).states_([["rec"], ["stop"]]);
EZSlider(w, Rect(0,0,200,20), \tempo, [0.1, 10, \exp], labelWidth: 40);
EZSlider(w, Rect(0,0,200,20), \start, [0, 1], labelWidth: 40);
EZSlider(w, Rect(0,0,200,20), \length, [0, 1], labelWidth: 40);
EZSlider(w, Rect(0,0,200,20), \jitter, [0, 1], labelWidth: 40);
w.view.decorator.nextLine.shift(0, 5);
Button(w, Rect(0, 0, 50, 20)).states_([["reverse"], ["forward"]]);
Button(w, Rect(0, 0, 50, 20)).states_([["inverse"], ["upright"]]);
Button(w, Rect(0, 0, 50, 20)).states_([["rescale"], ["noscale"]]);
Button(w, Rect(0, 0, 50, 20)).states_([["ctlMap"]]);
EZSlider(w, Rect(0,0,200,20), \scaler, [0, 10, \amp], labelWidth: 40);
EZSlider(w, Rect(0,0,200,20), \shift, \pan, labelWidth: 40);
)
c.dump;
c.ctlMap.keys.postcs;
GeneralHID.buildDeviceList;
d = GeneralHID.deviceList;
d[0][1].dump;
GamePad.subclasses.collect(_.vendorID);
d.select { |pair|
var rawdev, info; #rawdev, info = pair;
GamePad.subclasses.any { |cl| cl.vendorID == info.vendor }
or: { rawdev.usage == "GamePad"}
};