Class that contains the header chunk of a MIDI file. More...
#include <Header.h>
Inherits MIDI::Chunk.
Public Member Functions | |
Header () | |
Default constructor. | |
Header (byte *data, dword size) | |
Constructor. | |
int | formatType () |
unsigned int | numTracks () |
void | setNumTracks (unsigned int numTracks) |
int | timeDivisions () |
unsigned int | ticksPerBeat () |
void | setTicksPerBeat (unsigned int ticksPerBeat) |
Number of time delta positions per quarter note of music. | |
unsigned int | framesPerSecond () |
void | setFramesPerSecond (unsigned int setFramesPerSecond) |
Set frames per second. | |
unsigned int | ticksPerFrame () |
void | setTicksPerFrame (unsigned int ticksPerFrame) |
DataBuffer | data () |
Class that contains the header chunk of a MIDI file.
The header chunk contains the following information:
Each is described below. For more details, see the MIDI specification.
Definition at line 41 of file Header.h.
MIDI::Header::Header | ( | ) |
Default constructor.
Creates an empty MIDI header with all properties set to 0
Definition at line 31 of file Header.cpp.
Constructor.
Parses the array data to determine the contents of the header. The data is the set of bits after the chunk id and the chunk size.
Note: This constructor is not meant to be used outside of MIDIFile
data | The data | |
size | The number of bytes of data |
Definition at line 36 of file Header.cpp.
DataBuffer MIDI::Header::data | ( | ) | [virtual] |
Reimplemented from MIDI::Chunk.
Definition at line 101 of file Header.cpp.
int MIDI::Header::formatType | ( | ) |
The following format types exist:
Definition at line 54 of file Header.cpp.
unsigned int MIDI::Header::framesPerSecond | ( | ) |
Definition at line 76 of file Header.cpp.
unsigned int MIDI::Header::numTracks | ( | ) |
Definition at line 44 of file Header.cpp.
void MIDI::Header::setFramesPerSecond | ( | unsigned int | setFramesPerSecond | ) |
Set frames per second.
Using this functions nullifies any previous calls to Header::setTicksPerBeat()
framesPerSecond |
Definition at line 83 of file Header.cpp.
void MIDI::Header::setNumTracks | ( | unsigned int | numTracks | ) |
Set the number of tracks in the MIDI file.
Be careful when using this function. File::write() does not check that this value corresponds to the actual number of tracks.
numTracks | New value |
Definition at line 49 of file Header.cpp.
void MIDI::Header::setTicksPerBeat | ( | unsigned int | ticksPerBeat | ) |
Number of time delta positions per quarter note of music.
Using this functions nullifies any previous calls to Header::setFramesPerSecond() and Header::setTicksPerFrame()
ticksPerBeat | ticks per beat |
Definition at line 71 of file Header.cpp.
void MIDI::Header::setTicksPerFrame | ( | unsigned int | ticksPerFrame | ) |
Using this functions nullifies any previous calls to Header::setTicksPerBeat()
ticksPerFrame |
Definition at line 95 of file Header.cpp.
unsigned int MIDI::Header::ticksPerBeat | ( | ) |
Number of time delta positions per quarter note of music
Definition at line 64 of file Header.cpp.
unsigned int MIDI::Header::ticksPerFrame | ( | ) |
Ticks per frame, when timing is defined as frames per second.
Definition at line 88 of file Header.cpp.
int MIDI::Header::timeDivisions | ( | ) |
Used for translating the time deltas in events into real times. It can be stored as either ticks per beat or frames per second.
This function retuns the value that is stored inside the header. For decoded values, see other access functions.
Definition at line 59 of file Header.cpp.