]> ruin.nu Git - moosique.git/blobdiff - Moosique.java
no message
[moosique.git] / Moosique.java
index 13d7ce6c650adc260db8575ccdf849399b92d130..1c14a0fbe92ce0d558103c4bd011a85b5e6f4301 100644 (file)
@@ -1,6 +1,7 @@
 import javax.sound.midi.*;
-import javax.swing.*;
 import java.io.*;
+import javax.swing.*;
+import java.util.*;
 
 /**
  * Moosique - The MIDI Tracker
@@ -49,7 +50,7 @@ public class Moosique {
                        setActiveChannel(0);
                } catch (MidiUnavailableException e) {
                        System.out.println("Failed, quitting.");
-                       quit();
+//                     System.exit(1);
                }
                System.out.println("Done");
 
@@ -67,9 +68,12 @@ public class Moosique {
                        clearSequence();
                }
 
-               // If n-flag is set, plays song and then exits. Otherwise builds GUI.
+               // Builds GUI, unless n-flag is set.
                if (makeGUI) {
                        System.out.print("Building GUI...");
+                       try {
+                               UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+                       } catch (Exception e) {}
                        gui = new MooGUI(seq);
                        System.out.println("Done");
                } else {
@@ -216,7 +220,6 @@ public class Moosique {
                } catch (InvalidMidiDataException e) {
                        return false;
                } catch (IOException e) {
-                       JOptionPane.showMessageDialog(null, "Error 404", "File Not Found", JOptionPane.ERROR_MESSAGE); 
                        return false;
                }
 
@@ -232,6 +235,13 @@ public class Moosique {
                MidiMessage nextMsg;
                ShortMessage shortMsg;
                for (int i = 0; i < tracks.length; i++) {
+       /*
+                       Collections.sort(track[i].events, new Comparator() {
+                               public int compare(Object o1, Object o2) {
+                                       return ((MidiEvent)o2).getTick() - ((MidiEvent)o1).getTick();
+                               }
+                       });
+       */
                        for (int j = 0; j < tracks[i].size(); j++) {
                                noteOn = tracks[i].get(j);
                                if (noteOn.getMessage() instanceof ShortMessage) {
@@ -288,4 +298,4 @@ public class Moosique {
                if (synthesizer.isOpen()) synthesizer.close();
                System.exit(0);
        }
-}
\ No newline at end of file
+}