SHARE
TWEET

Untitled

a guest Nov 21st, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Some code adapted from Chuck docs
  2.  
  3. // HID
  4. Hid hi;
  5. HidMsg msg;
  6.  
  7. // which keyboard
  8. 0 => int device;
  9.  
  10. // open keyboard (get device number from command line)
  11. if( !hi.openKeyboard( device ) ) me.exit();
  12. <<< "keyboard '" + hi.name() + "' ready", "" >>>;
  13.  
  14.  
  15. int majorScale[10];
  16. [72, 74, 76, 77, 79, 81, 83, 84, 86, 88] @=> majorScale;
  17.  
  18. 6666 => int port;
  19. "localhost" => string hostname;
  20.  
  21. OscOut xmit;
  22.  
  23. xmit.dest(hostname, port);
  24.  
  25. while( true ){
  26.     //start the message name space
  27.     xmit.start("/osc/data,i");
  28.     hi => now;
  29.    
  30.     //get input from keyboard
  31.     while ( hi.recv(msg) ){
  32.         if (msg.isButtonDown()){
  33.  
  34.             if ( msg.which >= 30 && msg.which <= 39){
  35.            
  36.                 majorScale[msg.which - 30] => int note;
  37.            
  38.                 //add data to packet
  39.                 note => int temp => xmit.add;
  40.                 xmit.send();
  41.             }
  42.         }
  43.     }
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top