MIDI::File Class Reference

Class that describes a MIDI file. More...

#include <File.h>

Collaboration diagram for MIDI::File:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 File (string path)
 Constructor.
void setPath (string path)
 Change the MIDI file.
bool open ()
 Parse the MIDI file.
bool write ()
 Save to MIDI file.
Headerheader ()
Tracktrack (unsigned int id)
void addTrack (Track *track)
unsigned int numTracks ()

Protected Member Functions

ChunkreadChunk (ifstream &fh)

Detailed Description

Class that describes a MIDI file.

This is the main class of libmidi, and is designed such that it reflects the physical structore of a midi file.

The class is given a path to a MIDI file in the constructor. Calling MIDI::File::open() then parses the file and stores the information.

A MIDI file is divided into chunks. The first chunk is the header. The rest is tracks.

Definition at line 47 of file File.h.


Constructor & Destructor Documentation

MIDI::File::File ( string  path  ) 

Constructor.

Call MIDI::File::open() to parse the MIDI file

Parameters:
path Path to the MIDI file that is represented by this object

Definition at line 40 of file File.cpp.


Member Function Documentation

void MIDI::File::addTrack ( Track track  ) 

Append a new track to the end of the track list

Parameters:
track Track to append

Definition at line 64 of file File.cpp.

Header * MIDI::File::header (  ) 
Returns:
The header chunk

Definition at line 54 of file File.cpp.

unsigned int MIDI::File::numTracks (  ) 
Returns:
Number of tracks found in this MIDI file

Definition at line 49 of file File.cpp.

bool MIDI::File::open (  ) 

Parse the MIDI file.

Opens and extracs header and tracks from the midi file specified in the constructor

Returns:
False if there were problems, true otherwise.

Definition at line 99 of file File.cpp.

Chunk * MIDI::File::readChunk ( ifstream &  fh  )  [protected]

Tries to read the next chunk from the input file stream.

Returns:
The chunk that was read.

Definition at line 70 of file File.cpp.

void MIDI::File::setPath ( string  path  ) 

Change the MIDI file.

This function does nothing other than change the path. Use MIDI::File::open() or MIDI::File::write() to do something.

Parameters:
path Path to new MIDI file

Definition at line 44 of file File.cpp.

Track * MIDI::File::track ( unsigned int  id  ) 
Returns:
The idth track chunk

Definition at line 59 of file File.cpp.

bool MIDI::File::write (  ) 

Save to MIDI file.

Writes out the header and tracks to the midi file specified in the path variable

Returns:
False if there were problems, true otherwise

Definition at line 117 of file File.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 5 16:09:42 2010 for libmidi by  doxygen 1.6.1