From: Ben Morrow Date: Mon, 3 Mar 2014 06:31:10 +0000 (-0800) Subject: move to need keyEvent stuff from processing2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c0f98ab15b45d182218b576f73976b13befb586e;p=SugarCubes.git move to need keyEvent stuff from processing2 --- diff --git a/MIDI.pde b/MIDI.pde index 5a198f0..a618321 100644 --- a/MIDI.pde +++ b/MIDI.pde @@ -15,7 +15,7 @@ * set your SCPattern class to respond to the controllers that you * care about. */ - +import processing.event.*; interface MidiEngineListener { public void onFocusedDeck(int deckIndex); } @@ -264,7 +264,7 @@ public class VirtualKeyMidiInput extends SCMidiInput { } else { mapKeys(); } - //registerKeyEvent(this); + registerMethod("keyEvent",this); } private void mapAPC() { @@ -321,19 +321,19 @@ public class VirtualKeyMidiInput extends SCMidiInput { if (!enabled) { return; } - /* char c = 0;//0Character.toLowerCase(e.getKeyChar()); + char c = 0;//0Character.toLowerCase(e.getKeyChar()); NoteMeta nm = keyToNote.get(c); if (nm != null) { - switch (e.getID()) { - case KeyEvent.KEY_PRESSED: + switch (e.getKeyCode()) { + case KeyEvent.PRESS: noteOnReceived(new Note(Note.NOTE_ON, nm.channel, nm.number + octaveShift*12, 127)); break; - case KeyEvent.KEY_RELEASED: + case KeyEvent.RELEASE: noteOffReceived(new Note(Note.NOTE_OFF, nm.channel, nm.number + octaveShift*12, 0)); break; } } - if ((mode == KEYS) && (e.getID() == KeyEvent.KEY_PRESSED)) { + if ((mode == KEYS) && (e.getKeyCode() == KeyEvent.PRESS)) { switch (c) { case 'z': octaveShift = constrain(octaveShift-1, -4, 4); @@ -342,7 +342,7 @@ public class VirtualKeyMidiInput extends SCMidiInput { octaveShift = constrain(octaveShift+1, -4, 4); break; } - }*/ + } } }