AutoLoop - record a single controller and play it back fluidly.
// by hand, for a single controller
(
Ndef(\test, { |pFreq=100, pWidth=0.5, amp=0.2, pan, detune = 0.2|
Pan2.ar(LPF.ar(LFPulse.ar(pFreq + [detune, detune.neg], 0, pWidth).sum, 1500), pan, amp)
});
Spec.add(\pFreq, [2, 200, \exp]);
Spec.add(\pWidth, [0.01, 0.5, \exp]);
Spec.add(\detune, [0.01, 1, \exp]);
Ndef(\test).play;
c = AutoLoop(\test, (\pFreq: { |val| Ndef(\test).set(\pFreq, \pFreq.asSpec.map(val)) }));
c.getFunc_({ Ndef(\test).getKeysValues([\pFreq])[0] });
n = NodeProxyEditor(Ndef(\test), 5);
//n.edits[0].sliderView.mouseDownAction = { if (c.autoIsOn) { c.autoOn(rec: true) }; };
//n.edits[0].sliderView.mouseUpAction = { if (c.autoIsOn) { c.play } };
)
CtLoop.verbose_(true);
CtLoop.verbose_(false);
c.startRec;
c.play;
c.stop;
c.list.round(0.01).printcsAll; "";
////////////
( // make autoloop buttons for 5 sliders
Ndef(\test, { |pFreq=100, pWidth=0.5, amp=0.2, pan, detune = 0.2|
Pan2.ar(LPF.ar(LFPulse.ar(pFreq + [detune, detune.neg], 0, pWidth).sum, 1500), pan, amp)
});
Spec.add(\pFreq, [2, 200, \exp]);
Spec.add(\pWidth, [0.01, 0.5, \exp]);
Spec.add(\detune, [0.01, 1, \exp]);
n = NodeProxyEditor(Ndef(\test), 5);
n.w.bounds_(n.w.bounds.resizeBy(15,0));
n.edits.do { |ed, i|
var key = ed.labelView.string.asSymbol;
var ctloop = AutoLoop((\test ++ "_" ++ key).asSymbol, ());
ctloop.connectToProxyEditor(n, i);
ctloop.makeButton(n.w, Rect(340, i * 16 + 50, 12, 12));
};
)