]> ruin.nu Git - moosique.git/blobdiff - MooNote.java
Started on Moosique and MooNote. Changed comment in the others.
[moosique.git] / MooNote.java
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