libkmid Library API Documentation

MidiTrack Class Reference

Stores a MIDI track. Stores a MIDI track with a simple API. More...

#include <track.h>

List of all members.

Public Methods

 MidiTrack (FILE *file, int tpcn, int Id)
 Constructor.

 ~MidiTrack ()
 Destructor.

int ticksPassed (ulong ticks)
 Makes the iterator advance the given number of ticks.

int msPassed (ulong ms)
 Makes the iterator advance the given number of milliseconds.

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.


Detailed Description

Stores a MIDI track. Stores a MIDI track with a simple API.

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

Version:
0.9.5 17/01/2000
Author:
Antonio Larrosa Jimenez <larrosa@kde.org>

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.

References clear(), and init().

MidiTrack::~MidiTrack  
 

Destructor.

Definition at line 88 of file track.cc.


Member Function Documentation

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.

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.

int MidiTrack::currentMs double    ms
 

Returns the current millisecond which the iterator is at.

Definition at line 174 of file track.cc.

Referenced by MidiPlayer::play(), and MidiPlayer::setPos().

ulong MidiTrack::waitTicks void    [inline]
 

Returns the number of ticks left for the next event.

Definition at line 205 of file track.h.

double MidiTrack::absMsOfNextEvent void    [inline]
 

Returns the absolute number of milliseconds of the next event.

Definition at line 212 of file track.h.

Referenced by MidiPlayer::play(), and MidiPlayer::setPos().

void MidiTrack::changeTempo ulong    t
 

Change the tempo of the song.

Definition at line 544 of file track.cc.

Referenced by MidiPlayer::play(), and MidiPlayer::setPos().

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.

References MidiEvent::chn, MidiEvent::command, MidiEvent::ctl, MidiEvent::d1, MidiEvent::d2, MidiEvent::d3, MidiEvent::d4, MidiEvent::d5, MidiEvent::data, MidiEvent::length, MidiEvent::note, MidiEvent::patch, and MidiEvent::vel.

Referenced by MidiPlayer::play(), and MidiPlayer::setPos().

void MidiTrack::init void   
 

Initializes the iterator.

Definition at line 519 of file track.cc.

References clear().

Referenced by MidiTrack(), MidiPlayer::play(), and MidiPlayer::setPos().

void MidiTrack::clear void   
 

Clears the internal variables.

Definition at line 498 of file track.cc.

Referenced by init(), and MidiTrack().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:00 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001