]> ruin.nu Git - moosique.git/commitdiff
Started on Moosique and MooNote. Changed comment in the others.
authorEinar Pehrson <einarp@itstud.chalmers.se>
Thu, 10 Apr 2003 09:28:30 +0000 (09:28 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Thu, 10 Apr 2003 09:28:30 +0000 (09:28 +0000)
13 files changed:
MooGUI.java
MooMenu.java
MooNote.java
MooNoteElement.java
MooSequence.java
MooStatus.java
MooToolbar.java
MooTrack.java
MooTrackTitle.java
MooTrackView.java
MooView.java
MooViewCounter.java
Moosique.java

index 22ccb53e4fddd29227ca023e604734408fc1ca47..dcb52da9469934f4a310840128f5a99f25fa0361 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * Moosique's graphical user interface.
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooGUI {
 
-       /** 
+       /* 
         * Creates the GUI.
         */
        public MooGUI () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index 2d5c20a626ad1f9616aa8fd1d2496cea040125e7..cac3be4fc1189fb4034de8699e922c88e8a02621 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * 
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooMenu {
 
-       /** 
+       /* 
         * Creates the menus.
         */
        public MooMenu () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index edd815900705e538aafb1c68dcceb887ed4ac332..826b4c3c16ba00326eb9e0ebe5c6e8ed908280d9 100644 (file)
@@ -1,6 +1,6 @@
 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
@@ -9,16 +9,26 @@ import javax.sound.midi.*;
  
 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)
         */
@@ -26,7 +36,7 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * Sets the velocity of the current note.
         + @param vel   the velocity of the note (0-127)
         */
@@ -34,7 +44,7 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * 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)
         */
@@ -42,7 +52,7 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * Returns the note on event of the current note.
         * @return      the note on MidiEvent
         */
@@ -50,7 +60,7 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * Returns the note off event of the current note.
         * @return      the note off MidiEvent
         */
@@ -58,7 +68,7 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * Returns the pitch of the current note.
         * @return the pitch of the note
         */
@@ -66,7 +76,7 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * Returns the velocity of the current note.
         * @return the velocity of the note
         */
@@ -74,11 +84,11 @@ public class MooNote {
        
        }
 
-       /** 
+       /* 
         * Returns the length of the current note.
         * @return the length of the note
         */
        public int getLength() {
        
        }
-}
+}
\ No newline at end of file
index 60f153a15a950a42a04abb54e610916fd1a5cd66..8471b53d649fa8b9c49136d3113c85c8f41b4db5 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * Graphical representation of a MIDI note.
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooNoteElement {
 
-       /** 
+       /* 
         * Creates a new note element.
         */
        public MooNoteElement () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index 8b4c4e797a0cbb42c41dcf520f9d1b685048aee1..b37424e244022317a2e8a16b166f3bce256e3ac1 100644 (file)
@@ -1,23 +1,24 @@
 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
@@ -26,7 +27,7 @@ public class MooSequence {
        
        }
 
-       /** 
+       /* 
         * Returns the number of tracks in the current sequence.
         * @return the number of the tracks
         */
@@ -34,7 +35,7 @@ public class MooSequence {
        
        }
 
-       /** 
+       /* 
         * Creates a new track after the specified track.
         * @param track         the number of the track (0-31)
         */
@@ -42,7 +43,7 @@ public class MooSequence {
        
        }
 
-       /** 
+       /* 
         * Deletes the specified track.
         * @param track         the number of the track (0-31)
         */
@@ -50,7 +51,7 @@ public class MooSequence {
        
        }
 
-       /** 
+       /* 
         * Returns the Java Sequence object of the current sequence.
         * @return a Sequence
         */
@@ -58,10 +59,10 @@ public class MooSequence {
        
        }
 
-       /** 
+       /* 
         * Resets the solo and mute settings of all tracks.
         */
        public void activateTracks() {
        
        }
-}
+}
\ No newline at end of file
index 101dd7272aad4fc4023a8bfb34362512997e5f53..0f70b6c41a924e650eb52339dedfd6272bf9e30b 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * 
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooStatus {
 
-       /** 
+       /* 
         * Creates the status bar.
         */
        public MooStatus () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index 887fd8eba30fd4913286496a56f942a2524eb8a5..7ba77d6e468c34d8365f96d5c6fc197e827ed3c3 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * 
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class Moo {
 
-       /** 
+       /* 
         * Creates the toolbar.
         */
        public MooToolbar () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index f9d51f31c68838e857ab5dc3e6b4d13fc9a2b9d8..df542a6993467cf00d19ed955c1ddd0849139469 100644 (file)
@@ -1,6 +1,6 @@
 import javax.sound.midi.*;
 
-/**
+/*
  * Functional representation of a MIDI track.
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -12,18 +12,25 @@ public class MooTrack {
        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)
         */
@@ -31,23 +38,23 @@ public class MooTrack {
        
        }
 
-       /** 
-        * 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
         */
@@ -55,7 +62,7 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Deletes the given note to the current track.
         * @param note          the MooNote to delete
         */
@@ -63,7 +70,7 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Returns the note of the given index.
         * @param note          the index of the note
         */
@@ -71,7 +78,7 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Makes the current track solo.
         * @param set   if the track should be solo
         */
@@ -79,7 +86,7 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Mutes the current track.
         * @param set   if the track should be muted
         */
@@ -87,7 +94,7 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Checks if the current track is solo.
         * @return if the track is solo
         */
@@ -96,11 +103,11 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Checks if the current track is muted.
         * @return if the track is muted
         */
        public boolean isMute() {
        
        }
-}
+}
\ No newline at end of file
index 3090852634d97c75df761c4103db5855921e8fda..49082670e1df277bd87e11084fddf55ce198d1ff 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * The title bar for each track with track name, channel, instrument etc.
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooTrackTitle {
 
-       /** 
+       /* 
         * Creates the title bar.
         */
        public MooTrackTitle () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index 83ef2f5b96ffc27ad047e9ff8e397f0740a0b9e2..92a662b04651741433bd834b97b6fd6b41a07726 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * 
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooTrackView {
 
-       /** 
+       /* 
         * Creates 
         */
        public MooTrackView () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index c5cc49d40c188ada450f0923da8ae14cf0579dca..55bea7f248a1d3542e797ce9380e3b36236ac773 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * 
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooView {
 
-       /** 
+       /* 
         * Creates 
         */
        public MooView () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index 45a9280fff5fed228eb3073063ef74dbc0b3ae99..db6a036fb0fd43f65d51ab483f56c1fc154bedc5 100644 (file)
@@ -1,6 +1,6 @@
 import javax.swing.*;
 
-/**
+/*
  * 
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -9,14 +9,14 @@ import javax.swing.*;
  
 public class MooViewCounter {
 
-       /** 
+       /* 
         * Creates 
         */
        public MooViewCounter () {
 
        }
 
-       /** 
+       /* 
         * 
         */
        public void () {
index 720d0c860752ddb524fc74fb1770939e230ee0aa..8edc142920d3fba77e4f8ecc199d7b5ca736a955 100644 (file)
@@ -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