openpiano.midi
Class MidiNote

java.lang.Object
  extended by openpiano.midi.MidiNote
All Implemented Interfaces:
Comparable<MidiNote>

public class MidiNote
extends Object
implements Comparable<MidiNote>

The MidiNote class represents a single MIDI note

Version:
1.0, 07/30/08
Author:
Sascha Westermann

Constructor Summary
MidiNote(long startTick, long endTick, MidiMessage midiMessage)
          Constructs a new MIDI note
 
Method Summary
 int compareTo(MidiNote midiNote)
          Compares the start ticks of MIDI notes
 long getEndTick()
          Returns the end tick of the note
 int getKey()
          Returns the corresponding key for the note
 MidiMessage getMidiMessage()
          Returns the MIDI message for the note
 long getStartTick()
          Returns the start tick of the note
 int getVelocity()
          Returns the velocity of the note
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MidiNote

public MidiNote(long startTick,
                long endTick,
                MidiMessage midiMessage)
Constructs a new MIDI note

Parameters:
startTick - the start tick of the note
endTick - the end tick of the note
midiMessage - the MIDI message containing the note
Method Detail

getMidiMessage

public MidiMessage getMidiMessage()
Returns the MIDI message for the note

Returns:
the MIDI message for the note

getStartTick

public long getStartTick()
Returns the start tick of the note

Returns:
the start tick of the note

getEndTick

public long getEndTick()
Returns the end tick of the note

Returns:
the end tick of the note

getVelocity

public int getVelocity()
Returns the velocity of the note

Returns:
the velocity of the note

getKey

public int getKey()
Returns the corresponding key for the note

Returns:
the corresponding key for the note

compareTo

public int compareTo(MidiNote midiNote)
Compares the start ticks of MIDI notes

Specified by:
compareTo in interface Comparable<MidiNote>
Parameters:
midiNote - the MIDI note to compare with
Returns:
the difference of the start ticks