MidiTrack Class Reference

`#include <track.h>`

## Public Member Functions

| 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().

Stores a MIDI track with a simple API

Version
  0.9.5 17/01/2000

Author
  Antonio Larrosa Jimenez larro.nosp@m.sa@k.nosp@m.de.or.nosp@m.g

Definition at line 126 of file track.h.

## Constructor & Destructor Documentation

MidiTrack::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.

Definition at line 49 of file track.cc.

MidiTrack::~MidiTrack | ( |  | ) |

Destructor.

Definition at line 88 of file track.cc.

## Member Function Documentation

double MidiTrack::absMsOfNextEvent | ( | void |  | ) |

inline

Returns the absolute number of milliseconds of the next event.

Definition at line 212 of file track.h.

void MidiTrack::changeTempo | ( | ulong | t | ) |

Change the tempo of the song.

Definition at line 544 of file track.cc.

void MidiTrack::clear | ( | void |  | ) |

Clears the internal variables.

Definition at line 498 of file track.cc.

int MidiTrack::currentMs | ( | double | ms | ) |

Returns the current millisecond which the iterator is at.

Definition at line 174 of file track.cc.

void MidiTrack::init | ( | void |  | ) |

Initializes the iterator.

Definition at line 519 of file track.cc.

int MidiTrack::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() ).

Definition at line 158 of file track.cc.

void MidiTrack::readEvent | ( | MidiEvent * | ev | ) |

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

Definition at line 190 of file track.cc.

int MidiTrack::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() ).

Definition at line 146 of file track.cc.

ulong MidiTrack::waitTicks | ( | void |  | ) |

inline

Returns the number of ticks left for the next event.

Definition at line 205 of file track.h.

The documentation for this class was generated from the following files:

- track.h
- track.cc

KDE Home | KDE Accessibility Home | Description of Access Keys