public class MooKeyboard extends KeyAdapter {
private boolean[] isOn = new boolean[120];
- private static final int startNote = 48;
+ private static int startNote = 48;
private static final int[] keyToNote = new int[120];
/**
}
}
+ /**
+ * Sets the octave of the lower part of the keyboard (default = 4)
+ * @param n the octave to start at
+ */
+ public void setOctave(int n) {
+ startNote = n * 12;
+ }
+
/** Maps keycodes (array indices) to MIDI note numbers using the following layout:
*
* 2 3 5 6 7 9 0 => # # # # # # #
InputMap im = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
KeyStroke helpKey = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
- im.put(helpKey, "help");
\ No newline at end of file
+ im.put(helpKey, "help");
+
+* Oktavförändring i MooKeyboard
+ Mappa F9-F12 till MooKeyboard.setOctave(n) där n = {2, 4, 6, 8}
\ No newline at end of file