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
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)
*/
}
- /**
+ /*
* Sets the velocity of the current note.
+ @param vel the velocity of the note (0-127)
*/
}
- /**
+ /*
* 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)
*/
}
- /**
+ /*
* Returns the note on event of the current note.
* @return the note on MidiEvent
*/
}
- /**
+ /*
* Returns the note off event of the current note.
* @return the note off MidiEvent
*/
}
- /**
+ /*
* Returns the pitch of the current note.
* @return the pitch of the note
*/
}
- /**
+ /*
* Returns the velocity of the current note.
* @return the velocity of the note
*/
}
- /**
+ /*
* Returns the length of the current note.
* @return the length of the note
*/
public int getLength() {
}
-}
+}
\ No newline at end of file