s = Server.default;
s.options.numAnalogInChannels = 8;
s.options.numAnalogOutChannels = 8;
s.options.numDigitalChannels = 16;
s.options.blockSize = 16;
s.options.numInputBusChannels = 2;
s.options.numOutputBusChannels = 2;
s.options.postln;
s.waitForBoot({
{
Ndef(\trill, {
var i2c_bus = 1;
var i2c_address = 0x20;
var thresh = 0.625;
var prescaler = 1;
var centroids;
centroids = TrillCentroids.kr(i2c_bus, i2c_address, thresh, prescaler);
SendReply.kr(Impulse.kr(6), "/trillcentroiddata", centroids);
}).play;
s.sync;
OSCFunc({|...args|
//args.postln;
"_nr of fingers_ : ".post;
args[0][3].postln;
if(args[0][5] > 1000, {
" position 1 : ".post;
args[0][4].post;
" size 1 : ".post;
args[0][5].postln;
});
if(args[0][7] > 1000, {
" position 2 : ".post;
args[0][6].post;
" size 2 : ".post;
args[0][7].postln;
});
if(args[0][9] > 1000, {
" position 3 : ".post;
args[0][8].post;
" size 3 : ".post;
args[0][9].postln;
});
if(args[0][11] > 1000, {
" position 4 : ".post;
args[0][10].post;
" size 4 : ".post;
args[0][11].postln;
});
if(args[0][13] > 1000, {
" position 5 : ".post;
args[0][12].post;
" size 5 : ".post;
args[0][13].postln;
});
}, "/trillcentroiddata");
}.fork;
});