NiCMidi 1.1.0
A MIDI library derived from J.D.Koftinoff jdksmidi
|
Forward iterator for moving along a MIDITrack. More...
#include <track.h>
Public Member Functions | |
MIDITrackIterator (MIDITrack *trk) | |
The constructor. You must specify the track which the iterator is attached to. More... | |
void | Reset () |
Sets the current time to 0, updating the iterator status. More... | |
MIDITrack * | GetTrack () |
Returns a pointer to the track the iterator is attached to. More... | |
const MIDITrack * | GetTrack () const |
Returns a pointer to the track the iterator is attached to. More... | |
void | SetTrack (MIDITrack *trk) |
Sets the iterator track (causes a reset). More... | |
MIDIClockTime | GetCurrentTime () const |
Returns the current time of the iterator. More... | |
unsigned int | GetCurrentEventNum () const |
Returns the current event number in the track. More... | |
int16_t | GetProgram () const |
Returns the current track program (-1 if not set). More... | |
int16_t | GetControl (unsigned char c) const |
Returns the current value for the given control (-1 if not set). More... | |
int16_t | GetBender () const |
Returns the current bender value. More... | |
int | GetNotesOn () const |
Returns the number of notes on at current time. More... | |
bool | IsNoteOn (unsigned char n) const |
Returns true if the given note is on at current time. More... | |
bool | IsPedalOn () const |
Returns true if the hold pedal is on at current time. More... | |
bool | FindNoteOff (unsigned char note, MIDITimedMessage **msg) |
Finds the next MIDITimedMessage in the track corresponding to the note off for the given note. More... | |
bool | FindPedalOff (MIDITimedMessage **msg) |
Finds the next hold pedal off MIDITimedMessage in the track. More... | |
bool | GoToTime (MIDIClockTime time) |
Goes to the given time, which becomes the current time. More... | |
bool | GetNextEvent (MIDITimedMessage **msg) |
Returns the next event in the track. More... | |
bool | GetNextEventTime (MIDIClockTime *t) const |
Gets the time of the next event in the track. More... | |
bool | EventIsNow (const MIDITimedMessage &msg) |
Returns true if at the current time there is an event of the same kind of msg (see MIDITimedMessage::IsSameKind()). More... | |
Forward iterator for moving along a MIDITrack.
It defines a current time (initially 0) and a current event. You can move to any time in the track: when moving, it keeps track of program, bender, control changes and notes on.
MIDITrackIterator::MIDITrackIterator | ( | MIDITrack * | trk | ) |
The constructor. You must specify the track which the iterator is attached to.
void MIDITrackIterator::Reset | ( | ) |
Sets the current time to 0, updating the iterator status.
|
inline |
Returns a pointer to the track the iterator is attached to.
|
inline |
Returns a pointer to the track the iterator is attached to.
void MIDITrackIterator::SetTrack | ( | MIDITrack * | trk | ) |
Sets the iterator track (causes a reset).
|
inline |
Returns the current time of the iterator.
|
inline |
Returns the current event number in the track.
|
inline |
Returns the current track program (-1 if not set).
|
inline |
Returns the current value for the given control (-1 if not set).
|
inline |
Returns the current bender value.
|
inline |
Returns the number of notes on at current time.
|
inline |
Returns true if the given note is on at current time.
|
inline |
Returns true if the hold pedal is on at current time.
bool MIDITrackIterator::FindNoteOff | ( | unsigned char | note, |
MIDITimedMessage ** | msg | ||
) |
Finds the next MIDITimedMessage in the track corresponding to the note off for the given note.
[in] | note | : the note on |
[out] | msg | : a pointer to the note off message |
bool MIDITrackIterator::FindPedalOff | ( | MIDITimedMessage ** | msg | ) |
Finds the next hold pedal off MIDITimedMessage in the track.
[out] | msg | : a pointer to the pedal off message |
bool MIDITrackIterator::GoToTime | ( | MIDIClockTime | time | ) |
Goes to the given time, which becomes the current time.
This sets the current event to the first event in the track with time greater or equal to time.
bool MIDITrackIterator::GetNextEvent | ( | MIDITimedMessage ** | msg | ) |
Returns the next event in the track.
*msg | a pointer to the event in the MidiMultiTrack |
bool MIDITrackIterator::GetNextEventTime | ( | MIDIClockTime * | t | ) | const |
Gets the time of the next event in the track.
It can be different from current time if at current time there are not events.
t | here we get the time of next event, if valid. |
bool MIDITrackIterator::EventIsNow | ( | const MIDITimedMessage & | msg | ) |
Returns true if at the current time there is an event of the same kind of msg (see MIDITimedMessage::IsSameKind()).
The time of msg is ignored.