Class that describes a MIDI file. More...
#include <File.h>
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. | |
Header * | header () |
Track * | track (unsigned int id) |
void | addTrack (Track *track) |
unsigned int | numTracks () |
Protected Member Functions | |
Chunk * | readChunk (ifstream &fh) |
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.
MIDI::File::File | ( | string | path | ) |
Constructor.
Call MIDI::File::open() to parse the MIDI file
path | Path to the MIDI file that is represented by this object |
void MIDI::File::addTrack | ( | Track * | track | ) |
unsigned int MIDI::File::numTracks | ( | ) |
bool MIDI::File::open | ( | ) |
Chunk * MIDI::File::readChunk | ( | ifstream & | fh | ) | [protected] |
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.
path | Path to new MIDI file |
Track * MIDI::File::track | ( | unsigned int | id | ) |
bool MIDI::File::write | ( | ) |