demo Blaise = bonaldi

This commit is contained in:
tth 2019-08-28 22:39:06 +02:00
parent 517b381360
commit 244ff8d131
3 changed files with 76 additions and 1 deletions

41
chuck/pouet.ck Normal file
View File

@ -0,0 +1,41 @@
/* faire pouet avec chuck osc et un joystick
-----------------------------------------
reception des boutons
*/
7778 => int InPort;
SqrOsc sl => Envelope envl => dac.left;
SawOsc sr => Envelope envr => dac.right;
0.5 => sl.gain => sr.gain;
0.1 => envl.time; 0.25 => envr.time;
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 */
Std.mtof(base+(button)) => sl.freq;
Std.mtof(base+12+(button)) => sr.freq;
1 => envl.keyOn => envr.keyOn;
}
else {
1 => envl.keyOff => envr.keyOff;
}
// 0.2::second => now;
}
}
/* made in pi-ta-mere by tTh */

33
chuck/zwouit.ck Normal file
View File

@ -0,0 +1,33 @@
/* faire pouet avec chuck osc et un joystick
-----------------------------------------
reception des XY
*/
7777 => int InPort;
SqrOsc sl => dac.left;
SawOsc sr => dac.right;
0.0 => sl.gain => sr.gain;
OscIn oscin;
OscMsg msg;
InPort => oscin.port;
oscin.addAddress( "/joystick/xy, ii" );
int x, y;
55 => int base;
<<< "listening on port", InPort >>>;
while( true ) {
oscin => now;
while ( oscin.recv(msg) ) {
msg.getInt(0) => x;
msg.getInt(1) => y;
<<< "got (via ", InPort,") ", x, y >>>;
}
}
/* made in doubledragon2 by tTh */

View File

@ -115,12 +115,13 @@ lo_address loaddr;
FILE *fp; FILE *fp;
/* parsing command line options */ /* parsing command line options */
while ((opt = getopt(argc, argv, "hp:r:vI:")) != -1) { while ((opt = getopt(argc, argv, "hp:r:vw:I:")) != -1) {
switch (opt) { switch (opt) {
case 'h': help(0); break; case 'h': help(0); break;
case 'r': remote_host = optarg; break; case 'r': remote_host = optarg; break;
case 'p': remote_port = optarg; break; case 'p': remote_port = optarg; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'w': wait_time=atoi(optarg); break;
case 'I': my_id = optarg; break; case 'I': my_id = optarg; break;
default: exit(1); default: exit(1);
} }