\section{Midi\-Track Class Reference}
\label{classMidiTrack}\index{MidiTrack@{MidiTrack}}
Stores a MIDI track. Stores a MIDI track with a simple API.  


{\tt \#include $<$track.h$>$}

\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Midi\-Track} (FILE $\ast$file, int tpcn, int Id)
\begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\item 
{\bf $\sim$Midi\-Track} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
int {\bf ticks\-Passed} ({\bf ulong} ticks)
\begin{CompactList}\small\item\em Makes the iterator advance the given number of ticks. \item\end{CompactList}\item 
int {\bf ms\-Passed} ({\bf ulong} ms)
\begin{CompactList}\small\item\em Makes the iterator advance the given number of milliseconds. \item\end{CompactList}\item 
int {\bf current\-Ms} (double ms)
\begin{CompactList}\small\item\em Returns the current millisecond which the iterator is at. \item\end{CompactList}\item 
{\bf ulong} {\bf wait\-Ticks} (void)
\begin{CompactList}\small\item\em Returns the number of ticks left for the next event. \item\end{CompactList}\item 
double {\bf abs\-Ms\-Of\-Next\-Event} (void)
\begin{CompactList}\small\item\em Returns the absolute number of milliseconds of the next event. \item\end{CompactList}\item 
void {\bf change\-Tempo} ({\bf ulong} t)
\begin{CompactList}\small\item\em Change the tempo of the song. \item\end{CompactList}\item 
void {\bf read\-Event} ({\bf Midi\-Event} $\ast$ev)
\begin{CompactList}\small\item\em Reads the event at the iterator position, and puts it on the structure pointed to by {\tt ev}. \item\end{CompactList}\item 
void {\bf init} (void)
\begin{CompactList}\small\item\em Initializes the iterator. \item\end{CompactList}\item 
void {\bf clear} (void)
\begin{CompactList}\small\item\em Clears the internal variables. \item\end{CompactList}\end{CompactItemize}


\subsection{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 {\bf Midi\-Player::load\-Song}{\rm (p.\,\pageref{classMidiPlayer_a2})}() to load the song and later play it with {\bf Midi\-Player::play}{\rm (p.\,\pageref{classMidiPlayer_a7})}().

\begin{Desc}
\item[Version:]0.9.5 17/01/2000 \end{Desc}
\begin{Desc}
\item[Author:]Antonio Larrosa Jimenez $<${\tt larrosa@kde.org}$>$ \end{Desc}




Definition at line 126 of file track.h.

\subsection{Constructor \& Destructor Documentation}
\index{MidiTrack@{Midi\-Track}!MidiTrack@{MidiTrack}}
\index{MidiTrack@{MidiTrack}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Midi\-Track::Midi\-Track (FILE $\ast$ {\em file}, int {\em tpcn}, int {\em Id})}\label{classMidiTrack_a0}


Constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file}]the file to read the track from. It should be ready at the start of a track. Midi\-Track reads just that track and the file is left at the end of this track). \item[{\em tpcn}]the ticks per cuarter note used in this file. \item[{\em Id}]the ID for this track. \end{description}
\end{Desc}


Definition at line 49 of file track.cc.

References clear(), and init().\index{MidiTrack@{Midi\-Track}!~MidiTrack@{$\sim$MidiTrack}}
\index{~MidiTrack@{$\sim$MidiTrack}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Midi\-Track::$\sim${\bf Midi\-Track} ()}\label{classMidiTrack_a1}


Destructor. 



Definition at line 88 of file track.cc.

\subsection{Member Function Documentation}
\index{MidiTrack@{Midi\-Track}!ticksPassed@{ticksPassed}}
\index{ticksPassed@{ticksPassed}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Midi\-Track::ticks\-Passed ({\bf ulong} {\em ticks})}\label{classMidiTrack_a2}


Makes the iterator advance the given number of ticks. 

\begin{Desc}
\item[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 {\bf Midi\-Player::play}{\rm (p.\,\pageref{classMidiPlayer_a7})}() ). \end{Desc}


Definition at line 146 of file track.cc.\index{MidiTrack@{Midi\-Track}!msPassed@{msPassed}}
\index{msPassed@{msPassed}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Midi\-Track::ms\-Passed ({\bf ulong} {\em ms})}\label{classMidiTrack_a3}


Makes the iterator advance the given number of milliseconds. 

\begin{Desc}
\item[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 {\bf Midi\-Player::play}{\rm (p.\,\pageref{classMidiPlayer_a7})}() ). \end{Desc}


Definition at line 158 of file track.cc.\index{MidiTrack@{Midi\-Track}!currentMs@{currentMs}}
\index{currentMs@{currentMs}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Midi\-Track::current\-Ms (double {\em ms})}\label{classMidiTrack_a4}


Returns the current millisecond which the iterator is at. 



Definition at line 174 of file track.cc.

Referenced by Midi\-Player::play(), and Midi\-Player::set\-Pos().\index{MidiTrack@{Midi\-Track}!waitTicks@{waitTicks}}
\index{waitTicks@{waitTicks}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf ulong} Midi\-Track::wait\-Ticks (void)\hspace{0.3cm}{\tt  [inline]}}\label{classMidiTrack_a5}


Returns the number of ticks left for the next event. 



Definition at line 205 of file track.h.\index{MidiTrack@{Midi\-Track}!absMsOfNextEvent@{absMsOfNextEvent}}
\index{absMsOfNextEvent@{absMsOfNextEvent}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Midi\-Track::abs\-Ms\-Of\-Next\-Event (void)\hspace{0.3cm}{\tt  [inline]}}\label{classMidiTrack_a6}


Returns the absolute number of milliseconds of the next event. 



Definition at line 212 of file track.h.

Referenced by Midi\-Player::play(), and Midi\-Player::set\-Pos().\index{MidiTrack@{Midi\-Track}!changeTempo@{changeTempo}}
\index{changeTempo@{changeTempo}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Midi\-Track::change\-Tempo ({\bf ulong} {\em t})}\label{classMidiTrack_a7}


Change the tempo of the song. 



Definition at line 544 of file track.cc.

Referenced by Midi\-Player::play(), and Midi\-Player::set\-Pos().\index{MidiTrack@{Midi\-Track}!readEvent@{readEvent}}
\index{readEvent@{readEvent}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Midi\-Track::read\-Event ({\bf Midi\-Event} $\ast$ {\em ev})}\label{classMidiTrack_a8}


Reads the event at the iterator position, and puts it on the structure pointed to by {\tt ev}. 



Definition at line 190 of file track.cc.

References Midi\-Event::chn, Midi\-Event::command, Midi\-Event::ctl, Midi\-Event::d1, Midi\-Event::d2, Midi\-Event::d3, Midi\-Event::d4, Midi\-Event::d5, Midi\-Event::data, Midi\-Event::length, Midi\-Event::note, Midi\-Event::patch, and Midi\-Event::vel.

Referenced by Midi\-Player::play(), and Midi\-Player::set\-Pos().\index{MidiTrack@{Midi\-Track}!init@{init}}
\index{init@{init}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Midi\-Track::init (void)}\label{classMidiTrack_a9}


Initializes the iterator. 



Definition at line 519 of file track.cc.

References clear().

Referenced by Midi\-Track(), Midi\-Player::play(), and Midi\-Player::set\-Pos().\index{MidiTrack@{Midi\-Track}!clear@{clear}}
\index{clear@{clear}!MidiTrack@{Midi\-Track}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void Midi\-Track::clear (void)}\label{classMidiTrack_a10}


Clears the internal variables. 



Definition at line 498 of file track.cc.

Referenced by init(), and Midi\-Track().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
track.h\item 
track.cc\end{CompactItemize}
