From e0db3d674bae2b200460a098507735ae8622ab40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Thu, 3 Mar 2022 23:06:33 +0100 Subject: [PATCH] scosc fix, add another SC example --- scosc.scd | 2 +- scosc2.scd | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 scosc2.scd diff --git a/scosc.scd b/scosc.scd index 28a8a06..3941036 100644 --- a/scosc.scd +++ b/scosc.scd @@ -21,7 +21,7 @@ o = OSCFunc({ //[msg, time, addr, recvPort].postln; ~gX = msg[1]; ~gX.postln; -}, '/gyro/', n); +}, '/quaternion/', n); ) o.free // Get port diff --git a/scosc2.scd b/scosc2.scd new file mode 100644 index 0000000..1a8f263 --- /dev/null +++ b/scosc2.scd @@ -0,0 +1,39 @@ +s.boot(); + +~gW = 0; +~gX = 0; +~gY = 0; +~gZ = 0; + +( +z = { + arg f=440, amp=1, phase=0; + var so; + so = SinOsc.ar(f, phase) * amp; +}.play; +) + +( +y = { + arg f=440, amp=1, phase=0; + var so; + so = SinOsc.ar(f, phase) * amp; +}.play; +) + +// WW +// Receiver function +( +o = OSCFunc({ + arg msg, time, addr, recvPort; + //[msg, time, addr, recvPort].postln; + ~gX = msg[1]; + ~gY = msg[2]; + ~gZ = msg[3]; + ~gW = msg[0]; + z.set(\f, ~gX * 800); + y.set(\f, ~gY * 800); + y.set(\phase, ~gZ); +}, '/quaternion/', n); +) +// ENDWW \ No newline at end of file