]> ruin.nu Git - moosique.git/blobdiff - MooKeyboard.java
nu är även den fina scale velocity dialogen färdig
[moosique.git] / MooKeyboard.java
index 5581172e6d10792cbe5d6cbbae30c10b88ce492e..ef4785e67c5081e343983c06d411800dab2e1d1c 100644 (file)
@@ -64,11 +64,24 @@ public class MooKeyboard extends KeyAdapter {
         * @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   =>  # #   # # #   # #