From c0f98ab15b45d182218b576f73976b13befb586e Mon Sep 17 00:00:00 2001 From: Ben Morrow Date: Sun, 2 Mar 2014 22:31:10 -0800 Subject: [PATCH] move to need keyEvent stuff from processing2 --- MIDI.pde | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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; } - }*/ + } } } -- 2.34.1