]> ruin.nu Git - moosique.git/blobdiff - MooNote.java
Fixed recording!!!
[moosique.git] / MooNote.java
index fb73341e327f969ff51a50c23fbc5387d9f36b2b..57cf86c8529c9fef5ce0e59726b6c944f83ebc04 100644 (file)
@@ -44,6 +44,46 @@ public class MooNote extends MidiEvent implements Cloneable, Comparable {
                } catch (InvalidMidiDataException e) {System.out.println("Invalid data!");}
        }
 
+       /** 
+        * Returns the note off event of this note.
+        * @return the note off event
+        */
+       public MidiEvent getNoteOffEvent() {
+               return noteOffEvent;
+       }
+
+       /** 
+        * Returns the channel of the current note.
+        * @return the channel of the note (1-16)
+        */
+       public int getChannel() {
+               return noteOnMsg.getChannel();
+       }
+
+       /** 
+        * Returns the pitch of the current note.
+        * @return the pitch of the note (0-127)
+        */
+       public int getPitch() {
+               return noteOnMsg.getData1();
+       }
+
+       /** 
+        * Returns the velocity of the current note.
+        * @return the velocity of the note (0-127)
+        */
+       public int getVelocity() {
+               return noteOnMsg.getData2();
+       }
+
+       /** 
+        * Returns the duration of the current note.
+        * @return the duration of the note (in ticks)
+        */
+       public int getDuration() {
+               return (int)(noteOffEvent.getTick() - getTick());
+       }
+
        /** 
         * Sets the channel of the current note.
         * @param channel       the channel of the note (1-16)
@@ -102,38 +142,6 @@ public class MooNote extends MidiEvent implements Cloneable, Comparable {
                setPitch(getPitch() + halftones);
        }
 
-       /** 
-        * Returns the channel of the current note.
-        * @return the channel of the note (1-16)
-        */
-       public int getChannel() {
-               return noteOnMsg.getChannel();
-       }
-
-       /** 
-        * Returns the pitch of the current note.
-        * @return the pitch of the note (0-127)
-        */
-       public int getPitch() {
-               return noteOnMsg.getData1();
-       }
-
-       /** 
-        * Returns the velocity of the current note.
-        * @return the velocity of the note (0-127)
-        */
-       public int getVelocity() {
-               return noteOnMsg.getData2();
-       }
-
-       /** 
-        * Returns the duration of the current note.
-        * @return the duration of the note (in ticks)
-        */
-       public int getDuration() {
-               return (int)(noteOffEvent.getTick() - getTick());
-       }
-
        /**
         * Adds this note (both noteOn and noteOffEvents) to a track.
         * @param track the track it'll be added to.
@@ -167,7 +175,6 @@ public class MooNote extends MidiEvent implements Cloneable, Comparable {
         * @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
         */
        public int compareTo(Object o) {
-               return (int)(((MidiEvent)o).getTick() - getTick());
+               return (int)(getTick() - ((MidiEvent)o).getTick());
        }
-
 }