Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "localhost" => string hostname;
- 9990 => int port;
- "default" => string inst;
- 0 => int device;
- // check command line
- if( me.args() ) me.arg(0) => inst;
- Hid hi;
- HidMsg msg;
- if( !hi.openKeyboard( device ) ) me.exit();
- <<< "keyboard '" + hi.name() + "' ready", "" >>>;
- // send object
- OscOut xmit;
- // aim the transmitter
- xmit.dest( hostname, port );
- // infinite time loop
- while( true )
- {
- // wait for event
- hi => now;
- // get message
- while( hi.recv( msg ) )
- {
- // check
- if( msg.isButtonDown() )
- {
- // start the message...
- xmit.start( "/foo/notes" );
- // add int argument
- inst => xmit.add;
- // add float argument
- msg.which => xmit.add;
- }
- else {
- //if you want duration logic
- // start timer in msg.isButtonDown
- // then end here and send the time here
- }
- }
- // send it
- xmit.send();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement