From 244ff8d131d1aa26fc134618a4e357fa6f563271 Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 28 Aug 2019 22:39:06 +0200 Subject: [PATCH] demo Blaise = bonaldi --- chuck/pouet.ck | 41 +++++++++++++++++++++++++++++++++++++++++ chuck/zwouit.ck | 33 +++++++++++++++++++++++++++++++++ text2osc.c | 3 ++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 chuck/pouet.ck create mode 100644 chuck/zwouit.ck diff --git a/chuck/pouet.ck b/chuck/pouet.ck new file mode 100644 index 0000000..05f0bca --- /dev/null +++ b/chuck/pouet.ck @@ -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 */ + diff --git a/chuck/zwouit.ck b/chuck/zwouit.ck new file mode 100644 index 0000000..e94fd73 --- /dev/null +++ b/chuck/zwouit.ck @@ -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 */ + diff --git a/text2osc.c b/text2osc.c index c31c056..6093325 100644 --- a/text2osc.c +++ b/text2osc.c @@ -115,12 +115,13 @@ lo_address loaddr; FILE *fp; /* 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) { case 'h': help(0); break; case 'r': remote_host = optarg; break; case 'p': remote_port = optarg; break; case 'v': verbosity++; break; + case 'w': wait_time=atoi(optarg); break; case 'I': my_id = optarg; break; default: exit(1); }