gadgets-OSC/chuck/midi2osc.ck

44 lines
601 B
Plaintext
Raw Normal View History

2021-07-20 20:20:03 +11:00
/*
* recevoir des notes on/off par le MIDI
* et envoyer des boutons de joy par OSC
*
* nouveau Rural Art System 2021 - TerreBlanque
*/
2021-07-23 23:13:56 +11:00
MidiIn input;
MidiMsg msg;
2022-01-08 13:34:05 +11:00
OscOut xmit;
2021-07-20 20:20:03 +11:00
2021-07-23 23:13:56 +11:00
1 => int port; // please explain
2022-01-08 13:34:05 +11:00
9000 => int OSCPort;
2021-07-23 23:13:56 +11:00
if (!input.open(port)) {
<<< "erreur open" >>>;
me.exit();
}
// print out device that was opened
<<< "MIDI device:", input.num(), " -> ", input.name() >>>;
2022-01-08 13:34:05 +11:00
xmit.dest("localhost", OSCPort);
2021-07-23 23:13:56 +11:00
// infinite loop
while (1) {
input => now;
while ( input.recv(msg) ) {
<<< msg.data1, msg.data2, msg.data3 >>>;
2022-01-08 13:34:05 +11:00
xmit.start("/joystick/b");
2021-07-23 23:13:56 +11:00
}
}
2021-07-20 20:20:03 +11:00