public class NoteListGenerator extends java.lang.Object implements NoteEventParser
NoteListGenerator
parses Note On and Note Off events and generates a List of
the MidiNote
s present in any given song.Modifier and Type | Field and Description |
---|---|
private java.util.LinkedList<MidiNote> |
activeNotes
A list of the MidiNotes which have not yet been closed.
|
private java.util.List<MidiNote> |
completedNotes
A list of MidiNotes which have already been closed.
|
protected TimeTracker |
timeTracker
The TimeTracker for this NoteListGenerator.
|
Constructor and Description |
---|
NoteListGenerator(TimeTracker timeTracker)
Creates a new NoteListGenerator with the given TimeTracker.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.util.List<MidiNote>> |
getIncomingLists()
Returns a List of the incoming note lists.
|
java.util.List<MidiNote> |
getNoteList()
Returns a list of the notes present in this song, in time order.
|
void |
noteOff(int key,
long tick,
int channel)
Process a Note Off event.
|
MidiNote |
noteOn(int key,
int velocity,
long tick,
int channel)
Process a Note On event.
|
java.lang.String |
toString() |
private java.util.LinkedList<MidiNote> activeNotes
private java.util.List<MidiNote> completedNotes
protected TimeTracker timeTracker
public NoteListGenerator(TimeTracker timeTracker)
timeTracker
- public MidiNote noteOn(int key, int velocity, long tick, int channel)
NoteEventParser
noteOn
in interface NoteEventParser
key
- The key pressed. This will be a number between 1 and 88 for piano.velocity
- The velocity of the press. This is a value between 1 and 127 inclusive.tick
- The midi tick location of this event.channel
- The midi channel this note came from.public void noteOff(int key, long tick, int channel) throws javax.sound.midi.InvalidMidiDataException
NoteEventParser
noteOff
in interface NoteEventParser
key
- The midi key which has been turned off. This value is between 39 and 127, inclusive, for piano.tick
- The midi tick location of this event.channel
- The midi channel this note came from.javax.sound.midi.InvalidMidiDataException
- If a note off event doesn't match any previously seen note on events.public java.util.List<MidiNote> getNoteList()
public java.util.List<java.util.List<MidiNote>> getIncomingLists()
MidiModel.handleIncoming(List)
method.public java.lang.String toString()
toString
in class java.lang.Object