@@ -0,0 +1,1198 @@
+package com.haxademic.sketch.test;%0A%0Aimport java.awt.Robot;%0Aimport java.awt.event.KeyEvent;%0A%0Aimport com.haxademic.core.app.P;%0Aimport com.haxademic.core.app.PAppletHax;%0A%0A@SuppressWarnings(%22serial%22)%0Apublic class RobotKeyPressMidiTest%0Aextends PAppletHax %7B%0A%09%0A%09protected Robot _robot;%0A%09protected boolean _keyOn = false;%0A%0A%09protected void overridePropsFile() %7B%0A%09%09_appConfig.setProperty( %22width%22, %22640%22 );%0A%09%09_appConfig.setProperty( %22height%22, %22480%22 );%0A%09%7D%0A%0A%09public void setup() %7B%0A%09%09super.setup();%09%0A%09%09try %7B _robot = new Robot(); %7D catch( Exception error ) %7B println(%22couldn't init Robot%22); %7D%0A%09%7D%0A%0A%09public void drawApp() %7B%0A%09%09background(0);%0A%0A%09%09if(_keyOn == true) %7B%0A%09%09%09_robot.keyRelease(KeyEvent.VK_A);%0A%09%09%09_keyOn = false;%0A%09%09%7D%0A%09%7D%0A%09%0A%09/**%0A%09 * PApplet-level listener for MIDIBUS noteOn call%0A%09 */%0A%09public void noteOn(int channel, int  pitch, int velocity) %7B%0A%09%09P.println(channel, pitch, velocity);%0A%09%09if(pitch == 39) %7B%0A%09%09%09_keyOn = true;%0A%09%09%09_robot.keyPress(KeyEvent.VK_A);%0A%09%09%7D%0A%09%09if( _midi != null ) %7B %0A%09%09%09if( _midi.midiNoteIsOn( pitch ) == 0 ) %7B%0A%09%09%09%09_midi.noteOn( channel, pitch, velocity );%0A%09%09%09%09try%7B %0A%09%09%09%09%09handleInput( true );%0A%09%09%09%09%7D%0A%09%09%09%09catch( ArrayIndexOutOfBoundsException e )%7Bprintln(%22noteOn BROKE!%22);%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Converts midi drum pad signals into keyboard key presses