import javax.swing.*;
-/**
+/*
* Moosique's graphical user interface.
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooGUI {
- /**
+ /*
* Creates the GUI.
*/
public MooGUI () {
}
- /**
+ /*
*
*/
public void () {
import javax.swing.*;
-/**
+/*
*
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooMenu {
- /**
+ /*
* Creates the menus.
*/
public MooMenu () {
}
- /**
+ /*
*
*/
public void () {
import javax.sound.midi.*;
-/**
+/*
* Functional representation of a MIDI note, which contains two MIDI events, note on and note off.
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooNote {
- private MidiEvent noteOn, noteOff;
+ private MidiEvent noteOnEvent, noteOffEvent;
+ private ShortMessage noteOnMsg, noteOffMsg;
+ private long noteOnTime, noteOffTime;
- /**
+ /*
* Creates a MooNote of the given pitch, velocity and length in the current track.
*/
public MooNote (int pitch, int velocity, int length) {
-
+ // MidiEvent(MidiMessage message, long tick)
+ noteOnMsg = new ShortMessage();
+ noteOffMsg = new ShortMessage();
+ noteOnMsg.setMessage(ShortMessage.NOTE_ON, top.getChannel(), pitch, velocity);
+ noteOffMsg.setMessage(ShortMessage.NOTE_OFF, top.getChannel(), pitch, velocity);
+// noteOnTime = ???;
+ noteOffTime = noteOnTime + length;
+ noteOnEvent = new MidiEvent(noteOnMsg, noteOnTime)
+ noteOffEvent = new MidiEvent(noteOffMsg, noteOffTime)
}
- /**
+ /*
* Sets the pitch of the current note.
+ @param pitch the pitch of the note (0-127)
*/
}
- /**
+ /*
* Sets the velocity of the current note.
+ @param vel the velocity of the note (0-127)
*/
}
- /**
+ /*
* Sets the length of the current note (or rather moves the note off event).
+ @param n the length of the note in ticks (100 per beat)
*/
}
- /**
+ /*
* Returns the note on event of the current note.
* @return the note on MidiEvent
*/
}
- /**
+ /*
* Returns the note off event of the current note.
* @return the note off MidiEvent
*/
}
- /**
+ /*
* Returns the pitch of the current note.
* @return the pitch of the note
*/
}
- /**
+ /*
* Returns the velocity of the current note.
* @return the velocity of the note
*/
}
- /**
+ /*
* Returns the length of the current note.
* @return the length of the note
*/
public int getLength() {
}
-}
+}
\ No newline at end of file
import javax.swing.*;
-/**
+/*
* Graphical representation of a MIDI note.
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooNoteElement {
- /**
+ /*
* Creates a new note element.
*/
public MooNoteElement () {
}
- /**
+ /*
*
*/
public void () {
import javax.sound.midi.*;
-/**
+/*
* Functional representation of a MIDI sequence.
+ *
* @author Andersson, Andreen, Lanneskog, Pehrson
- * @version 1.1
+ * @version 1
*/
public class MooSequence {
private Collection tracks;
- /**
+ /*
* Creates a MooSequence with three tracks.
*/
public MooSequence () {
}
- /**
+ /*
* Returns a pointer to the specified track.
* @param track the number of the track (0-31)
* @return the specified track
}
- /**
+ /*
* Returns the number of tracks in the current sequence.
* @return the number of the tracks
*/
}
- /**
+ /*
* Creates a new track after the specified track.
* @param track the number of the track (0-31)
*/
}
- /**
+ /*
* Deletes the specified track.
* @param track the number of the track (0-31)
*/
}
- /**
+ /*
* Returns the Java Sequence object of the current sequence.
* @return a Sequence
*/
}
- /**
+ /*
* Resets the solo and mute settings of all tracks.
*/
public void activateTracks() {
}
-}
+}
\ No newline at end of file
import javax.swing.*;
-/**
+/*
*
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooStatus {
- /**
+ /*
* Creates the status bar.
*/
public MooStatus () {
}
- /**
+ /*
*
*/
public void () {
import javax.swing.*;
-/**
+/*
*
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class Moo {
- /**
+ /*
* Creates the toolbar.
*/
public MooToolbar () {
}
- /**
+ /*
*
*/
public void () {
import javax.sound.midi.*;
-/**
+/*
* Functional representation of a MIDI track.
*
* @author Andersson, Andreen, Lanneskog, Pehrson
private Collection notes;
private int channel;
private int instrument;
- private boolean solo;
- private boolean mute;
+ private boolean solo = false;
+ private boolean mute = false;
-
- /**
+ /*
* Creates an empty MooTrack.
*/
public MooTrack () {
}
- /**
+ /*
+ * Sets the MIDI instrument of the current track.
+ * @param instr the number of the MIDI instrument (0-127)
+ */
+ public void setInstrument(int instr) {
+
+ }
+
+ /*
* Sets the MIDI channel of the current track.
* @param chan the number of the MIDI channel (1-16)
*/
}
- /**
- * Sets the MIDI instrument of the current track.
- * @param instr the number of the MIDI instrument (0-127)
+ /*
+ * Returns the MIDI channel of the current track.
+ * @return the number of the channel
*/
- public void setInstrument(int instr) {
+ public int getChannel() {
}
- /**
+ /*
* Returns the number of notes in the current track.
* @return the number of notes
*/
- public void getNumberOfNotes() {
+ public int getNumberOfNotes() {
}
- /**
+ /*
* Adds the given note to the current track.
* @param note the MooNote to add
*/
}
- /**
+ /*
* Deletes the given note to the current track.
* @param note the MooNote to delete
*/
}
- /**
+ /*
* Returns the note of the given index.
* @param note the index of the note
*/
}
- /**
+ /*
* Makes the current track solo.
* @param set if the track should be solo
*/
}
- /**
+ /*
* Mutes the current track.
* @param set if the track should be muted
*/
}
- /**
+ /*
* Checks if the current track is solo.
* @return if the track is solo
*/
}
- /**
+ /*
* Checks if the current track is muted.
* @return if the track is muted
*/
public boolean isMute() {
}
-}
+}
\ No newline at end of file
import javax.swing.*;
-/**
+/*
* The title bar for each track with track name, channel, instrument etc.
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooTrackTitle {
- /**
+ /*
* Creates the title bar.
*/
public MooTrackTitle () {
}
- /**
+ /*
*
*/
public void () {
import javax.swing.*;
-/**
+/*
*
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooTrackView {
- /**
+ /*
* Creates
*/
public MooTrackView () {
}
- /**
+ /*
*
*/
public void () {
import javax.swing.*;
-/**
+/*
*
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooView {
- /**
+ /*
* Creates
*/
public MooView () {
}
- /**
+ /*
*
*/
public void () {
import javax.swing.*;
-/**
+/*
*
*
* @author Andersson, Andreen, Lanneskog, Pehrson
public class MooViewCounter {
- /**
+ /*
* Creates
*/
public MooViewCounter () {
}
- /**
+ /*
*
*/
public void () {
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.
*
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
*/
}
- /**
+ /*
* Fast forwards the current sequence the given number of measures.
* @param measures the number of measures to fast forward
*/
}
- /**
+ /*
* Loads the MooSequence in the given file.
* @param filename the filename to use
*/
}
- /**
+ /*
* Saves the current sequence to the given filename
* @param filename the filename to use
*/
}
- /**
+ /*
* 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