]> ruin.nu Git - moosique.git/blobdiff - MooTrack.java
Implemented some obvious methods.
[moosique.git] / MooTrack.java
index f9d51f31c68838e857ab5dc3e6b4d13fc9a2b9d8..b14bcca97de709b8491b0368f11c67108572b41f 100644 (file)
@@ -1,6 +1,6 @@
 import javax.sound.midi.*;
 
-/**
+/*
  * Functional representation of a MIDI track.
  * 
  * @author  Andersson, Andreen, Lanneskog, Pehrson
@@ -12,50 +12,59 @@ 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 () {
+               notes = new Collection();
+               setInstrument(0);
+               // Find the first available channel
+       }
 
+       /* 
+        * Sets the MIDI instrument of the current track.
+        * @param instr         the number of the MIDI instrument (0-127)
+        */
+       public void setInstrument(int instr) {
+               instrument = instr;     
        }
 
-       /** 
+       /* 
         * Sets the MIDI channel of the current track.
         * @param chan          the number of the MIDI channel (1-16)
         */
        public void setChannel(int chan) {
-       
+               channel = chan;
        }
 
-       /** 
-        * 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() {
+               return channel;
        }
 
-       /** 
+       /* 
         * Returns the number of notes in the current track.
         * @return      the number of notes
         */
-       public void getNumberOfNotes() {
-       
+       public int getNumberOfNotes() {
+               return notes.size();
        }
 
-       /** 
+       /* 
         * Adds the given note to the current track.
         * @param note          the MooNote to add
         */
        public void addNote(MooNote note) {
-       
+               notes.add(note);
        }
 
-       /** 
+       /* 
         * Deletes the given note to the current track.
         * @param note          the MooNote to delete
         */
@@ -63,44 +72,44 @@ public class MooTrack {
        
        }
 
-       /** 
+       /* 
         * Returns the note of the given index.
         * @param note          the index of the note
         */
        public MooNote getNote(int note) {
-       
+               return notes.get(note);
        }
 
-       /** 
+       /* 
         * Makes the current track solo.
         * @param set   if the track should be solo
         */
-       public void solo(boolean set) {
-       
+       public void setSolo(boolean set) {
+               solo = set;
        }
 
-       /** 
+       /* 
         * Mutes the current track.
         * @param set   if the track should be muted
         */
-       public void mute(boolean set) {
-       
+       public void setMute(boolean set) {
+               mute = set;     
        }
 
-       /** 
+       /* 
         * Checks if the current track is solo.
         * @return if the track is solo
         */
 
        public boolean isSolo() {
-       
+               return solo;
        }
 
-       /** 
+       /* 
         * Checks if the current track is muted.
         * @return if the track is muted
         */
        public boolean isMute() {
-       
+               return mute;
        }
-}
+}
\ No newline at end of file