|
|
Stores a MIDI track. This can be thought of as a list of MIDI events.
The data types used to store the track is similar to how events are stored on a MIDI file, but used in a way that allows for faster parses.
This class is used on MidiPlayer::loadSong() to load the song and later play it with MidiPlayer::play().
MidiTrack (FILE *file,int tpcn,int Id) |
Constructor.
Parameters:
file | the file to read the track from. It should be ready at the start of a track. MidiTrack reads just that track and the file is left at the end of this track). |
tpcn | the ticks per cuarter note used in this file. |
Id | the ID for this track. |
~MidiTrack () |
Destructor
int ticksPassed (ulong ticks) |
Makes the iterator advance the given number of ticks.
Returns: 0 if OK, and 1 if you didn't handle this track well and you forgot to take an event (thing that will never happen if you use MidiPlayer::play() ).
int msPassed (ulong ms) |
Makes the iterator advance the given number of milliseconds.
Returns: 0 if OK, and 1 if you didn't handle this track well and you forgot to take an event (thing that will never happen if you use MidiPlayer::play() ).
int currentMs (double ms) |
Returns the current millisecond which the iterator is at.
ulong waitTicks (void) |
Returns the number of ticks left for the next event.
double absMsOfNextEvent (void) |
Returns the absolute number of milliseconds of the next event.
void changeTempo (ulong t) |
Change the tempo of the song.
void readEvent (MidiEvent *ev) |
Reads the event at the iterator position, and puts it on the structure
pointed to by ev
.
void init (void) |
Initializes the iterator.
void clear (void) |
Clears the internal variables.