X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Moosique.java;h=42c5e2e03fea09b18c15c566d3fa044502107d01;hb=ade446bcfe30be5e4a058926387763f72fc3d4a7;hp=720d0c860752ddb524fc74fb1770939e230ee0aa;hpb=1d6b560878a23df9ecea49c5511a8fa5da895ebf;p=moosique.git diff --git a/Moosique.java b/Moosique.java index 720d0c8..42c5e2e 100644 --- a/Moosique.java +++ b/Moosique.java @@ -1,8 +1,9 @@ import javax.sound.midi.*; import java.io.*; +// Import external MIDIFileReader and MIDIFileWriter -/** - * Moosique - The trackers approach to MIDI +/* + * Moosique - The MIDI Tracker * * Main class that handles initiation, IO and sound FX. * @@ -13,46 +14,61 @@ import java.io.*; public class Moosique { private static MooGUI gui; - private static MooSequence seq; + private static MooSequence mooSeq; + private static Sequence seq; + private static Sequencer sequencer = null; private static String filename; + private static int position; - /** - * Runs the application. + /* + * Starts the application. */ public static void main (String[] args) { + // Creates song and GUI + seq = new MooSequence(); + gui = new MooGUI(mooSeq); + // Initializes MIDI sequencer + try { + sequencer = MidiSystem.getSequencer(); + sequencer.open(); + } catch (MidiUnavailableException e) { + System.exit(0); + } } - /** + /* * Returns a pointer to the current sequence. * @return the current sequence */ public static MooSequence getSequence() { - + return mooSeq; } - /** + /* * Starts playback of the current sequence. */ public static void play() { - + seq = mooSeq.getSequence(); + sequencer.setSequence(seq); + sequencer.start(); } - /** + /* * Pauses playback of the current sequence. */ public static void pause() { } - /** + /* * Stops playback of the current sequence. */ public static void stop() { - + sequencer.stop(); } - /** + /* * Rewinds the current sequence the given number of measures. * @param measures the number of measures to rewind */ @@ -60,7 +76,7 @@ public class Moosique { } - /** + /* * Fast forwards the current sequence the given number of measures. * @param measures the number of measures to fast forward */ @@ -68,7 +84,7 @@ public class Moosique { } - /** + /* * Loads the MooSequence in the given file. * @param filename the filename to use */ @@ -76,7 +92,7 @@ public class Moosique { } - /** + /* * Saves the current sequence to the given filename * @param filename the filename to use */ @@ -84,18 +100,18 @@ public class Moosique { } - /** + /* * Saves the current sequence to the previously given filename. */ public static void save() throws IOException { } - /** + /* * Exports the current sequence to a standard MIDI file. * @param filename the filename to use */ public static void exportMIDI(String filename) throws IOException { } -} +} \ No newline at end of file