# class MidiTrack | Stores a MIDI track with a simple API. More...
Definition | `#include <track.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- MidiTrack (FILE *file,int tpcn,int Id)
- ~MidiTrack ()
- int ticksPassed (ulong ticks)
- int msPassed (ulong ms)
- int currentMs (double ms)
- ulong waitTicks (void)
- double absMsOfNextEvent (void)
- void changeTempo (ulong t)
- void readEvent (MidiEvent *ev)
- void init (void)
- void clear (void)

## Detailed Description

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) | ### MidiTrack

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 () | ### ~MidiTrack

Destructor

int ticksPassed (ulong ticks) | ### ticksPassed

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) | ### msPassed

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) | ### currentMs

Returns the current millisecond which the iterator is at.

ulong waitTicks (void) | ### waitTicks

Returns the number of ticks left for the next event.

double absMsOfNextEvent (void) | ### absMsOfNextEvent

Returns the absolute number of milliseconds of the next event.

void changeTempo (ulong t) | ### changeTempo

Change the tempo of the song.

void readEvent (MidiEvent *ev) | ### readEvent

Reads the event at the iterator position, and puts it on the structure pointed to by `ev`.

void init (void) | ### init

Initializes the iterator.

void clear (void) | ### clear

Clears the internal variables.

- Version: 0.9.5 17/01/2000
- Author: Antonio Larrosa Jimenez <larrosa@kde.org>
- Generated: root@sparc.ports.openbsd.org on Wed May 2 09:49:53 2001, using kdoc 2.0a53.