2020+2 a new hope ?

This commit is contained in:
tth 2022-01-08 03:34:05 +01:00
parent 95046aa71d
commit 85c1846a0b
4 changed files with 22 additions and 6 deletions

View File

@ -6,6 +6,8 @@ pour lancer Chuck sans connexion audio.
## dessiner.ck
Faire des courbes de Lissajous...
## pouet.ck
## midi2osc.ck

View File

@ -7,8 +7,8 @@
*
*/
7777 => int OSCPort;
31000.0 => float Amplitude;
9000 => int OSCPort;
32760.0 => float Amplitude;
OscOut xmit;
float dx, dy;
@ -20,17 +20,19 @@ clear_the_screen();
for (0 => int foo; foo<25800; foo++) {
<<< foo >>>;
Amplitude * Math.sin(foo * 0.30001) => dx;
Amplitude * Math.cos(foo * 0.50001) => dy;
Amplitude * Math.sin(foo * 0.3001) => dx;
Amplitude * Math.cos(foo * 0.4999) => dy;
xmit.start("/joystick/xy");
Std.ftoi(dx) => xmit.add;
Std.ftoi(dy) => xmit.add;
xmit.send();
0.02::second => now;
0.025::second => now;
}
// ----------------------------------------------------
fun void clear_the_screen()
{
xmit.start("/joystick/b");
@ -40,3 +42,5 @@ xmit.start("/joystick/b");
50 => xmit.add; 0 => xmit.add;
xmit.send();
}
// ----------------------------------------------------

View File

@ -7,8 +7,10 @@
MidiIn input;
MidiMsg msg;
OscOut xmit;
1 => int port; // please explain
9000 => int OSCPort;
if (!input.open(port)) {
<<< "erreur open" >>>;
@ -18,12 +20,20 @@ if (!input.open(port)) {
// print out device that was opened
<<< "MIDI device:", input.num(), " -> ", input.name() >>>;
xmit.dest("localhost", OSCPort);
// infinite loop
while (1) {
input => now;
while ( input.recv(msg) ) {
<<< msg.data1, msg.data2, msg.data3 >>>;
xmit.start("/joystick/b");
}

View File

@ -9,7 +9,7 @@ SqrOsc sl => Envelope envl => dac.left;
SawOsc sr => Envelope envr => dac.right;
0.5 => sl.gain => sr.gain;
0.01 => envl.time; 0.06 => envr.time;
0.01 => envl.time; 0.04 => envr.time;
OscIn oscin; OscMsg msg;