* @param n the octave to start at
*/
public static void setOctave(int n) {
- if ((startNote == 0 && n == -1) || (startNote == 108 && n == 1)) return;
- startNote += n*12;
+ 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);
+ }
+ }
+
/** Maps keycodes (array indices) to MIDI note numbers using the following layout:
*
* 2 3 5 6 7 9 0 => # # # # # # #