JITseto
superclass: [TUIObject]
/*
Author:
2006
Till Bovermann
SonEnvir IEM
KUG Graz
Austria
*/
a JIT interface to SETObjects.
///////////////////////
(
/*
SETOIDistance.distFunc = {|distance, isValid, parts| postf("%<->% : %\n", parts[0].id, parts[1].id, distance)};
*/
t = SETOServer("_ixyzuvw", JITseto, SETOIDistance);
t.start;
// inspect its behavior
//i = t.inspect;
g = t.gui;
)
t.stop;
t.start;
JITseto.action = {1.postln}
JITseto.action = nil
p = ProxySpace.push(s)
s.boot
~a.play;
~b.play;
(
~a = {|freqs = #[100,0], t_trig = 0|
EnvGen.kr(Env.perc, gate: t_trig) * SinOsc.ar(freqs.lag, 0, 3).softclip * 0.5
};
~b = {|freqs = #[100,0], t_trig = 0|
EnvGen.kr(Env.perc, gate: t_trig) * Saw.ar(freqs.lag).softclip * 0.5
}
)
(
var fSpecs = [[100, 500, \exp].asSpec,[100, 500, \exp].asSpec];
JITseto.action = {|setObj|
var freqs;
(setObj.id == 100).if{
freqs = fSpecs.collect{|spec, i| spec.map(setObj.pos[i])};
~a.group.setn(\freqs, freqs);
~a.group.set(\t_trig, 1);
};
(setObj.id == 101).if{
freqs = fSpecs.collect{|spec, i| spec.map(setObj.pos[i])};
~b.group.setn(\freqs, freqs);
~b.group.set(\t_trig, 1);
}
}
)
// now create two TUIOs with id 100 / 101 and move them around.
~a.unset(\freqs)
~a.free(3);
~b.free(3);
~a.play
p.clear;
//////////////////////////////////////////////////////
q = q ? ();
(
q.lastSymAxis = [0, 0, 1];
q.symAxis = [1, 0, 0];
q.ltime = SystemClock.seconds;
JITseto.action = {|setObj| (setObj.id == 1).if{
var time = SystemClock.seconds;
var flipAngleVel;
// symmetric axis is determined as z Axis;
q.symAxis = setObj.rotMat.flop.last;
flipAngleVel = acos((q.symAxis * q.lastSymAxis).sum) / (time - q.ltime).max(0.0001);
// flipAngleVel = acos((q.symAxis * q.lastSymAxis).sum);
q.lastSymAxis = q.symAxis;
q.ltime = time;
// flipAngleVel.postln;
~a.group.set(\freqs, (flipAngleVel*4).midicps )
}}
)