2023-01-14 01:36:31 +11:00
|
|
|
/*
|
|
|
|
faire pouet avec chuck osc et un joystick
|
2019-08-29 07:39:06 +11:00
|
|
|
-----------------------------------------
|
|
|
|
reception des boutons
|
|
|
|
*/
|
|
|
|
|
|
|
|
7778 => int InPort;
|
|
|
|
|
|
|
|
SqrOsc sl => Envelope envl => dac.left;
|
|
|
|
SawOsc sr => Envelope envr => dac.right;
|
|
|
|
0.5 => sl.gain => sr.gain;
|
|
|
|
|
2023-01-14 01:36:31 +11:00
|
|
|
0.22 => envl.time; 0.22 => envr.time;
|
2019-08-29 07:39:06 +11:00
|
|
|
|
|
|
|
OscIn oscin; OscMsg msg;
|
|
|
|
|
|
|
|
InPort => oscin.port; oscin.addAddress( "/joystick/b, ii" );
|
|
|
|
|
|
|
|
int button, value; 50 => int base;
|
|
|
|
|
|
|
|
<<< "listening on port", InPort >>>;
|
|
|
|
|
|
|
|
while( true ) {
|
|
|
|
oscin => now;
|
|
|
|
while ( oscin.recv(msg) ) {
|
|
|
|
msg.getInt(0) => button;
|
|
|
|
msg.getInt(1) => value;
|
|
|
|
<<< "got (via ", InPort,")\tb", button, "\tv", value >>>;
|
|
|
|
if (1 == value) { /* button down */
|
2021-07-23 23:13:56 +11:00
|
|
|
Std.mtof(base+(button)) => sl.freq;
|
2019-08-29 07:39:06 +11:00
|
|
|
Std.mtof(base+12+(button)) => sr.freq;
|
|
|
|
1 => envl.keyOn => envr.keyOn;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
1 => envl.keyOff => envr.keyOff;
|
|
|
|
}
|
2021-07-24 05:41:39 +11:00
|
|
|
0.1::second => now;
|
2019-08-29 07:39:06 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* made in pi-ta-mere by tTh */
|
|
|
|
|