Advertisement
Guest User

MusicTech

a guest
Nov 18th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. "localhost" => string hostname;
  2. 9990 => int port;
  3. "default" => string inst;
  4. 0 => int device;
  5.  
  6. // check command line
  7. if( me.args() ) me.arg(0) => inst;
  8.  
  9. Hid hi;
  10. HidMsg msg;
  11.  
  12. if( !hi.openKeyboard( device ) ) me.exit();
  13. <<< "keyboard '" + hi.name() + "' ready", "" >>>;
  14.  
  15. // send object
  16. OscOut xmit;
  17.  
  18. // aim the transmitter
  19. xmit.dest( hostname, port );
  20.  
  21. // infinite time loop
  22. while( true )
  23. {
  24. // wait for event
  25. hi => now;
  26.  
  27. // get message
  28. while( hi.recv( msg ) )
  29. {
  30. // check
  31. if( msg.isButtonDown() )
  32. {
  33. // start the message...
  34. xmit.start( "/foo/notes" );
  35.  
  36. // add int argument
  37. inst => xmit.add;
  38. // add float argument
  39. msg.which => xmit.add;
  40. }
  41. else {
  42. //if you want duration logic
  43. // start timer in msg.isButtonDown
  44. // then end here and send the time here
  45. }
  46. }
  47.  
  48. // send it
  49. xmit.send();
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement