Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Some code adapted from Chuck docs
- // HID
- Hid hi;
- HidMsg msg;
- // which keyboard
- 0 => int device;
- // open keyboard (get device number from command line)
- if( !hi.openKeyboard( device ) ) me.exit();
- <<< "keyboard '" + hi.name() + "' ready", "" >>>;
- int majorScale[10];
- [72, 74, 76, 77, 79, 81, 83, 84, 86, 88] @=> majorScale;
- 6666 => int port;
- "localhost" => string hostname;
- OscOut xmit;
- xmit.dest(hostname, port);
- while( true ){
- //start the message name space
- xmit.start("/osc/data,i");
- hi => now;
- //get input from keyboard
- while ( hi.recv(msg) ){
- if (msg.isButtonDown()){
- if ( msg.which >= 30 && msg.which <= 39){
- majorScale[msg.which - 30] => int note;
- //add data to packet
- note => int temp => xmit.add;
- xmit.send();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement