]> ruin.nu Git - moosique.git/blobdiff - Moosique.java
no message
[moosique.git] / Moosique.java
index 1c14a0fbe92ce0d558103c4bd011a85b5e6f4301..bc821ba034bf49f69fc9ee4c33c7dcfd9d43b089 100644 (file)
@@ -22,7 +22,7 @@ public class Moosique {
 
        private static String filename, fileArg;
        private static long position;
-       private static boolean makeGUI = true;
+       private static boolean makeGUI = true, isEdited;
 
        /** 
         * Starts the application.
@@ -177,21 +177,36 @@ public class Moosique {
        }
 
        /** 
-        * Rewinds the current sequence the given number of measures.
-        * @param measures      the number of measures to rewind
+        * Returns the current tick position of the sequencer.
+        * @return the tick position
         */
        public static long getPosition() {
                return position;
        }
 
        /** 
-        * Rewinds the current sequence the given number of measures.
-        * @param measures      the number of measures to rewind
+        * Sets the current tick position of the sequencer.
+        * @param ticks         the tick position
         */
        public static void setPosition(long ticks) {
                position = ticks;
        }
 
+       /** 
+        * Returns true if the current sequence has been edited.
+        * @return the tick position
+        */
+       public static boolean isEdited() {
+               return isEdited;
+       }
+
+       /** 
+        * Sets the current sequence as edited, which implies prompts when loading a new sequence.
+        */
+       public static void setEdited() {
+               isEdited = true;
+       }
+
        /** 
         * Rewinds the current sequence the given number of measures.
         * @param measures      the number of measures to rewind
@@ -222,13 +237,8 @@ public class Moosique {
                } catch (IOException e) {
                        return false;
                }
-
-               // Sends sequence to GUI and sequencer
-               if (gui != null) gui.setSequence(seq);
-               try {
-                       sequencer.setSequence(seq);
-               } catch (InvalidMidiDataException e) {}
-
+               isEdited = false;
+               
                // Searches the sequence for NoteOn events
                Track[] tracks = seq.getTracks();
                MidiEvent noteOn, noteOff = null, nextEvent;
@@ -269,6 +279,11 @@ public class Moosique {
                                }
                        }
                }
+               // Sends sequence to GUI and sequencer, then returns
+               if (gui != null) gui.setSequence(seq);
+               try {
+                       sequencer.setSequence(seq);
+               } catch (InvalidMidiDataException e) {}
                return true;
        }