X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Moosique.java;h=bc821ba034bf49f69fc9ee4c33c7dcfd9d43b089;hb=ffc69c8cc2cc9cdfe3841c77c1e680dee2225c63;hp=1c14a0fbe92ce0d558103c4bd011a85b5e6f4301;hpb=8de46b00b4e2df79a5b45111bcb981880fca21cf;p=moosique.git diff --git a/Moosique.java b/Moosique.java index 1c14a0f..bc821ba 100644 --- a/Moosique.java +++ b/Moosique.java @@ -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; }