]> ruin.nu Git - moosique.git/commitdiff
no message
authorEinar Pehrson <einarp@itstud.chalmers.se>
Sun, 18 May 2003 15:18:38 +0000 (15:18 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Sun, 18 May 2003 15:18:38 +0000 (15:18 +0000)
MooGUI.java
MooKeyboard.java
To Do.txt

index 77883c9c2b3d271e602a96d27f7a5337ce709da9..43c553a5d0f11336cb3a1a25f56e5733124ce8b3 100644 (file)
@@ -93,7 +93,7 @@ public class MooGUI extends JFrame {
                pack();
                setIconImage(logo);
                Dimension bounds = Toolkit.getDefaultToolkit().getScreenSize();
-               setSize(bounds.width,bounds.height - 40);
+               setSize(bounds.width,bounds.height - 28);
                setLocation(0, 0);
                setBackground(Color.white);
                advanceStatus();
index 7031c40711c1831c50802947fe01cf186066b1e2..5581172e6d10792cbe5d6cbbae30c10b88ce492e 100644 (file)
@@ -11,29 +11,34 @@ public class MooKeyboard extends KeyAdapter {
 
        private boolean[] isOn;
        private static int startNote;
-       private static int[] keyToNote;
+       private static int[] keyToNote = new int[120];
 
        /**
         * Sets up the synthesizer emulation.
         */
        public MooKeyboard() {
                isOn = new boolean[120];
-               keyToNote = new int[120];
-               setOctave(4);
        }
 
+       static {
+               startNote = 48;
+               makeKeyboardMapping();
+       }
+       
        /**
         * Plays the appropriate MIDI NoteOn event.
         */
        public void keyPressed(KeyEvent e) {
-               try {
-                       // Retrieves the notenumber from the conversion array.
-                       int noteNumber = keyToNote[e.getKeyCode()];
-                       // If note is not already on and the key is mapped to a note, sends the NoteOn event.
-                       if (!isOn[noteNumber] && noteNumber > 0) Moosique.getActiveChannel().noteOn(noteNumber, 127);
-                       isOn[noteNumber] = true;
-               } catch (ArrayIndexOutOfBoundsException x) {
-                       return;
+               if (!e.isControlDown()) {
+                       try {
+                               // Retrieves the notenumber from the conversion array.
+                               int noteNumber = keyToNote[e.getKeyCode()];
+                               // If note is not already on and the key is mapped to a note, sends the NoteOn event.
+                               if (!isOn[noteNumber] && noteNumber > 0) Moosique.getActiveChannel().noteOn(noteNumber, 127);
+                               isOn[noteNumber] = true;
+                       } catch (ArrayIndexOutOfBoundsException x) {
+                               return;
+                       }
                }
        }
        
@@ -41,14 +46,16 @@ public class MooKeyboard extends KeyAdapter {
         * Plays the appropriate MIDI NoteOff event.
         */
        public void keyReleased(KeyEvent e) {
-               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;
+                       }
                }
        }
 
@@ -57,7 +64,7 @@ public class MooKeyboard extends KeyAdapter {
         * @param n     the octave to start at
         */
        public static void setOctave(int n) {
-               if (startNote == 0 || startNote == 108) return;
+               if ((startNote == 0 && n == -1) || (startNote == 108 && n == 1)) return;
                startNote += n*12;
                makeKeyboardMapping();
        }
index 2a768bdcbfdbf6e718ddc43cc7b354040748faa3..dedc490e5f26d01447b60af34c7bedcfbc4ff151 100644 (file)
--- a/To Do.txt
+++ b/To Do.txt
@@ -8,6 +8,7 @@ x Spara konfiguration?
        Arbetskatalog
        Fem senast öppnade filerna
        Valda MIDI-enheter
+x Inspelning!
 
 TEMPO / TAKTART
 x Räkna ut tempo och taktart. Skicka (på nåt sätt) tempovektorn till MooToolbar.