X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooNote.java;h=d57772b92be50251ce9a06bb2456344cff570772;hb=2f2b387add66ddc0d8f8c1e301f4718792e969b6;hp=826b4c3c16ba00326eb9e0ebe5c6e8ed908280d9;hpb=4e7d6f8b7dd7fbcef2282674b5442d78cf220489;p=moosique.git diff --git a/MooNote.java b/MooNote.java index 826b4c3..d57772b 100644 --- a/MooNote.java +++ b/MooNote.java @@ -17,23 +17,23 @@ public class MooNote { * 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); + noteOnMsg.setMessage(ShortMessage.NOTE_ON, pitch, velocity); + noteOffMsg.setMessage(ShortMessage.NOTE_OFF, pitch, velocity); // noteOnTime = ???; noteOffTime = noteOnTime + length; - noteOnEvent = new MidiEvent(noteOnMsg, noteOnTime) - noteOffEvent = new MidiEvent(noteOffMsg, noteOffTime) + 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) + * @param pitch the pitch of the note (0-127) */ public void setPitch(int pitch) { - + noteOnMsg.setMessage(ShortMessage.NOTE_ON, pitch, noteOnMsg.getData2()); + noteOffMsg.setMessage(ShortMessage.NOTE_OFF, pitch, noteOffMsg.getData2()); } /* @@ -41,7 +41,8 @@ public class MooNote { + @param vel the velocity of the note (0-127) */ public void setVelocity(int vel) { - + noteOnMsg.setMessage(ShortMessage.NOTE_ON, noteOnMsg.getData1(), vel); + noteOffMsg.setMessage(ShortMessage.NOTE_OFF, noteOffMsg.getData1(), vel); } /* @@ -49,7 +50,7 @@ public class MooNote { + @param n the length of the note in ticks (100 per beat) */ public void setLength(int ticks) { - + } /* @@ -57,7 +58,7 @@ public class MooNote { * @return the note on MidiEvent */ public MidiEvent getNoteOnEvent() { - + return noteOnEvent; } /* @@ -65,7 +66,7 @@ public class MooNote { * @return the note off MidiEvent */ public MidiEvent getNoteOffEvent() { - + return noteOffEvent; } /* @@ -73,7 +74,7 @@ public class MooNote { * @return the pitch of the note */ public int getPitch() { - + return noteOnMsg.getData1(); } /* @@ -81,7 +82,7 @@ public class MooNote { * @return the velocity of the note */ public int getVelocity() { - + return noteOnMsg.getData2(); } /*