X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Moosique.java;h=8edc142920d3fba77e4f8ecc199d7b5ca736a955;hb=4e7d6f8b7dd7fbcef2282674b5442d78cf220489;hp=720d0c860752ddb524fc74fb1770939e230ee0aa;hpb=d4d9008e23b5a9125056589ffc22877a800e72cc;p=moosique.git diff --git a/Moosique.java b/Moosique.java index 720d0c8..8edc142 100644 --- a/Moosique.java +++ b/Moosique.java @@ -1,8 +1,8 @@ import javax.sound.midi.*; import java.io.*; -/** - * Moosique - The trackers approach to MIDI +/* + * Moosique - The MIDI Tracker * * Main class that handles initiation, IO and sound FX. * @@ -13,46 +13,60 @@ 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; - /** - * 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 +74,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 +82,7 @@ public class Moosique { } - /** + /* * Loads the MooSequence in the given file. * @param filename the filename to use */ @@ -76,7 +90,7 @@ public class Moosique { } - /** + /* * Saves the current sequence to the given filename * @param filename the filename to use */ @@ -84,18 +98,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