Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // started from a ChucK example
- // modified by Les Hall
- // beginningTue Nov 18 2014
- //
- SinOsc colOsc => Gain sum => dac;
- SinOsc rowOsc => sum;
- 0 => sum.gain;
- [1209, 1336, 1477, 1633] @=> int colFreqs[];
- [697, 770, 852, 941] @=> int rowFreqs[];
- // create our OSC receiver
- OscRecv recv;
- // use port 6449 (or whatever)
- 11000 => recv.port;
- // start listening (launch thread)
- recv.listen();
- // create an address in the receiver, store in new variable
- recv.event( "/gyrosc/button, i i" ) @=> OscEvent @ oe;
- // infinite event loop
- while( true )
- {
- // wait for event to arrive
- oe => now;
- // grab the next message from the queue.
- while( oe.nextMsg() )
- {
- oe.getInt() => int buttonNum;
- oe.getInt() => int buttonPos;
- <<< "got (via OSC):", buttonNum, buttonPos >>>;
- rowFreqs[buttonNum%3] => rowOsc.freq;
- colFreqs[buttonNum/3] => colOsc.freq;
- 1 => sum.gain;
- 250::ms => now;
- 0 => sum.gain;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement