- try {
- // Retrieves the notenumber from the conversion array.
- int noteNumber = keyToNote[e.getKeyCode()];
- // Sends the NoteOff event.
- Moosique.getActiveChannel().noteOff(noteNumber);
- isOn[noteNumber] = false;
- } catch (ArrayIndexOutOfBoundsException x) {
- return;
+ if (!e.isControlDown()) {
+ try {
+ // Retrieves the notenumber from the conversion array.
+ int noteNumber = keyToNote[e.getKeyCode()];
+ // Sends the NoteOff event.
+ Moosique.getActiveChannel().noteOff(noteNumber);
+ isOn[noteNumber] = false;
+ } catch (ArrayIndexOutOfBoundsException x) {
+ return;
+ }
+ }
+ }
+
+ /**
+ * Sets the octave of the lower part of the keyboard (default = 4)
+ * @param n the octave to start at
+ */
+ public static void setOctave(int n) {
+ startNote = n * 12;
+ makeKeyboardMapping();
+ }
+
+ /**
+ * Increases or decreases the octave of the lower part of the keyboard (default = 4)
+ * @param increase true for increase, false for decrease
+ */
+ public static void setRelativeOctave(boolean increase) {
+ if (increase) {
+ if (startNote == 108) return;
+ setOctave((startNote/12) + 1);
+ } else {
+ if (startNote == 0) return;
+ setOctave((startNote/12) - 1);