OpenTTD
|
Data Structures | |
struct | DataBlock |
struct | TempoChange |
Public Member Functions | |
bool | LoadFile (const char *filename) |
Load a standard MIDI file. More... | |
bool | LoadMpsData (const byte *data, size_t length) |
Create MIDI data from song data for the original Microprose music drivers. More... | |
bool | LoadSong (const MusicSongInfo &song) |
void | MoveFrom (MidiFile &other) |
Move data from other to this, and clears other. More... | |
bool | WriteSMF (const char *filename) |
Write a Standard MIDI File containing the decoded music. More... | |
Static Public Member Functions | |
static std::string | GetSMFFile (const MusicSongInfo &song) |
Get the name of a Standard MIDI File for a given song. More... | |
static bool | ReadSMFHeader (const char *filename, SMFHeader &header) |
Read the header of a standard MIDI file. More... | |
static bool | ReadSMFHeader (FILE *file, SMFHeader &header) |
Read the header of a standard MIDI file. More... | |
Data Fields | |
std::vector< DataBlock > | blocks |
sequential time-annotated data of file, merged to a single track | |
std::vector< TempoChange > | tempos |
list of tempo changes in file | |
uint16 | tickdiv |
ticks per quarter note | |
Definition at line 23 of file midifile.hpp.
|
static |
Get the name of a Standard MIDI File for a given song.
For songs already in SMF format, just returns the original. Otherwise the song is converted, written to a temporary-ish file, and the written filename is returned.
song | Song definition to query |
Definition at line 1041 of file midifile.cpp.
References MusicSongInfo::filetype, and MTT_STANDARDMIDI.
Referenced by MusicDriver_ExtMidi::PlaySong().
bool MidiFile::LoadFile | ( | const char * | filename | ) |
Load a standard MIDI file.
filename | name of the file to load |
Definition at line 451 of file midifile.cpp.
References BASESET_DIR, FioFCloseFile(), and FioFOpenFile().
bool MidiFile::LoadMpsData | ( | const byte * | data, |
size_t | length | ||
) |
Create MIDI data from song data for the original Microprose music drivers.
data | pointer to block of data |
length | size of data in bytes |
Definition at line 833 of file midifile.cpp.
References MpsMachine::PlayInto().
void MidiFile::MoveFrom | ( | MidiFile & | other | ) |
Move data from other to this, and clears other.
other | object containing loaded data to take over |
Definition at line 867 of file midifile.cpp.
|
static |
Read the header of a standard MIDI file.
[in] | filename | name of file to read from |
[out] | header | filled with data read |
Definition at line 409 of file midifile.cpp.
References BASESET_DIR, FioFCloseFile(), and FioFOpenFile().
|
static |
Read the header of a standard MIDI file.
The function will consume 14 bytes from the current file pointer position.
[in] | file | open file to read from (should be in binary mode) |
[out] | header | filled with data read |
Definition at line 425 of file midifile.cpp.
References MemCmpT().
bool MidiFile::WriteSMF | ( | const char * | filename | ) |
Write a Standard MIDI File containing the decoded music.
filename | Name of file to write to |
Definition at line 911 of file midifile.cpp.
References FioFOpenFile(), and NO_DIRECTORY.