1 import javax.sound.midi.*;
5 * Moosique - The MIDI Tracker
7 * Main class that handles initiation, IO and sound FX.
9 * @author Andersson, Andreen, Lanneskog, Pehrson
13 public class Moosique {
15 private static MooGUI gui;
16 private static MooSequence mooSeq;
17 private static Sequence seq;
18 private static Sequencer sequencer = null;
19 private static String filename;
22 * Starts the application.
24 public static void main (String[] args) {
25 // Creates song and GUI
26 seq = new MooSequence();
27 gui = new MooGUI(mooSeq);
29 // Initializes MIDI sequencer
31 sequencer = MidiSystem.getSequencer();
33 } catch (MidiUnavailableException e) {
39 * Returns a pointer to the current sequence.
40 * @return the current sequence
42 public static MooSequence getSequence() {
47 * Starts playback of the current sequence.
49 public static void play() {
50 seq = mooSeq.getSequence();
51 sequencer.setSequence(seq);
56 * Pauses playback of the current sequence.
58 public static void pause() {
63 * Stops playback of the current sequence.
65 public static void stop() {
70 * Rewinds the current sequence the given number of measures.
71 * @param measures the number of measures to rewind
73 public static void rewind(int measures) {
78 * Fast forwards the current sequence the given number of measures.
79 * @param measures the number of measures to fast forward
81 public static void forward(int measures) {
86 * Loads the MooSequence in the given file.
87 * @param filename the filename to use
89 public static void load(String filename) throws IOException {
94 * Saves the current sequence to the given filename
95 * @param filename the filename to use
97 public static void saveAs(String filename) throws IOException {
102 * Saves the current sequence to the previously given filename.
104 public static void save() throws IOException {
109 * Exports the current sequence to a standard MIDI file.
110 * @param filename the filename to use
112 public static void exportMIDI(String filename) throws IOException {