WIP supercollider port

master
Jurij Podgoršek 2024-06-17 14:40:21 +02:00
parent 8f230d152e
commit 5cd54c0abf
1 changed files with 65 additions and 0 deletions

65
danijela.scd 100644
View File

@ -0,0 +1,65 @@
// Namestitev
// SLIP -> OSC
Quarks.install("https://git.kompot.si/g1smo/SLIPDecoder.git");
// Quaternioni
Quarks.install("MathLib");
// Zlistaj serijske naprave
SerialPort.listDevices;
// Zacni
(
var receiver;
OSCFunc.trace(false);
~wwS = SLIPDecoder.new("/dev/ttyUSB0", 115200, "/ww/0");
~wwS.stop;
~wwS.start;
~eX = 0;
~eY = 0;
~eZ = 0;
~refQ = Quaternion.new();
~zadnjiQ = Quaternion.new(1, 0, 0, 0);
~gumbi = Array.fill(4, false);
// Pucamo star listener
thisProcess.removeOSCRecvFunc(~sprejemnik);
~sprejemnik = {|msg|
//msg.postln;
msg[0].switch(
'/ww/0/quaternion', {
var novQ, diffQ, euler;
//msg[(1..4)].postln;
"novQ!".postln;
novQ = Quaternion.new(*msg[(1..4)]);
//novQ.postln;
//(novQ * ~zadnjiQ.conjugate).postln;
diffQ = novQ / ~zadnjiQ.conjugate;
diffQ.postln;
~zadnjiQ = novQ;
}
);
};
thisProcess.addOSCRecvFunc(~sprejemnik);
)
(
~a = Quaternion(1, 0.5, 0.5, 0.5);
~b = Quaternion(1, 0.4, 0.6, 0.5);
(~a / Quaternion.new()).postln;
)
// Ustavi
~wwS.stop;
// Zacni
~wwS.start;
thisProcess.listOscRecvFunc();