import javax.swing.*;
import java.io.*;
-/* UPDATES
- Killed superfluous exportMIDI method.
- Added public static void quit()
- Removed Sequence seq property.
- Changed forward(int measures) and rewind(int measures) to forward(long ticks) and rewind(long ticks).
- Added public static long getPosition()
- Added public static void setPosition(long ticks)
- Added public static void resume()
-*/
-
/*
* Moosique - The MIDI Tracker
*
}
//If a filename is given as the command-line argument, attempts to load a sequence from the file.
- try {
- if (args.length == 1) {
- if (!load(args[0])) seq = new Sequence(Sequence.PPQ, 96);
- } else {
- // Otherwise creates a new empty one.
- seq = new Sequence(Sequence.PPQ, 96);
- }
- } catch (InvalidMidiDataException e) {}
+ if (args.length == 1) {
+ if (!load(args[0])) createSequence();
+ } else {
+ // Otherwise creates a new empty one.
+ createSequence();
+ }
// Sets up channels and GUI.
channels = synthesizer.getChannels();
- gui = new MooGUI();
+ gui = new MooGUI(seq);
}
/*
return seq;
}
+ /*
+ * Returns a pointer to the current sequence.
+ * @return the current sequence
+ */
+ public static void createSequence() {
+ try {
+ seq = new Sequence(Sequence.PPQ, 96);
+ } catch (InvalidMidiDataException e) {}
+ }
+
/*
* Starts playback of the current sequence.
*/
public static void play() {
try {
sequencer.setSequence(seq);
+ sequencer.setTickPosition(position);
} catch (InvalidMidiDataException e) {}
- sequencer.setTickPosition(position);
sequencer.start();
}