private static long position;
private static boolean makeGUI = true, isEdited;
private static Thread player;
+ public static final int RESOLUTION = 96, DEFAULT_TRACKS = 4;
/**
* Starts the application.
return channels;
}
+ /**
+ * Returns the MidiChannels of the selected synthesizer.
+ * @return the available MidiChannels
+ */
+ public static MidiChannel getChannel(int i) {
+ return channels[i];
+ }
+
/**
* Returns the currently active MidiChannel.
* @return the active MidiChannel
public static void clearSequence() {
// Creates a new sequence and sends it to the sequencer.
try {
- seq = new Sequence(Sequence.PPQ, 96, 3);
+ seq = new Sequence(Sequence.PPQ, RESOLUTION, DEFAULT_TRACKS);
sequencer.setSequence(seq);
} catch (InvalidMidiDataException e) {}
// Sends sequence to GUI.
public static void play() {
sequencer.setTickPosition(position);
resume();
-
}
/**
*/
public static void pause() {
sequencer.stop();
- player.destroy();
+ player.interrupt();
}
/**
// Creates the visualization thread and starts it.
player = new Thread () {
public void run() {
- gui.update(sequencer.getTickPosition());
+ while(sequencer.isRunning()) gui.update(sequencer.getTickPosition());
+ Moosique.stop();
}
};
player.start();
public static void stop() {
sequencer.stop();
sequencer.setTickPosition(position);
- player.destroy();
+ player.interrupt();
gui.update((long)0);
}