Public Member Functions | |
const char * | Start (const char *const *param) |
Initialized the MIDI player, including QuickTime initialization. | |
void | Stop () |
Stops the MIDI player. | |
void | PlaySong (const char *filename) |
Starts playing a new song. | |
void | StopSong () |
Stops playing the current song, if the player is active. | |
bool | IsSongPlaying () |
Checks whether the player is active. | |
void | SetVolume (byte vol) |
Changes the playing volume of the MIDI player. | |
const char * | GetName () const |
Get the name of this driver. |
Definition at line 17 of file qtmidi.h.
const char* MusicDriver_QtMidi::GetName | ( | ) | const [inline, virtual] |
bool MusicDriver_QtMidi::IsSongPlaying | ( | ) | [virtual] |
Checks whether the player is active.
This function is called at regular intervals from OpenTTD's main loop, so we call MoviesTask()
from here to let QuickTime do its work.
Implements MusicDriver.
Definition at line 200 of file qtmidi.cpp.
References _quicktime_movie, _quicktime_started, _quicktime_state, QT_STATE_IDLE, QT_STATE_PLAY, and QT_STATE_STOP.
void MusicDriver_QtMidi::PlaySong | ( | const char * | filename | ) | [virtual] |
Starts playing a new song.
filename | Path to a MIDI file. |
Implements MusicDriver.
Definition at line 259 of file qtmidi.cpp.
References _quicktime_movie, _quicktime_started, _quicktime_state, DEBUG, LoadMovieForMIDIFile(), QT_STATE_IDLE, QT_STATE_PLAY, QT_STATE_STOP, StopSong(), and VOLUME.
void MusicDriver_QtMidi::SetVolume | ( | byte | vol | ) | [virtual] |
Changes the playing volume of the MIDI player.
As QuickTime controls volume in a per-movie basis, the desired volume is stored in _quicktime_volume, and the volume is set here using the VOLUME macro, and when loading new song in PlaySong.
vol | The desired volume, range of the value is 0-127 |
Implements MusicDriver.
Definition at line 319 of file qtmidi.cpp.
References _quicktime_movie, _quicktime_started, _quicktime_state, _quicktime_volume, DEBUG, QT_STATE_IDLE, QT_STATE_PLAY, QT_STATE_STOP, and VOLUME.
const char * MusicDriver_QtMidi::Start | ( | const char *const * | parm | ) | [virtual] |
Initialized the MIDI player, including QuickTime initialization.
Gestalt()
and EnterMovies()
. Needs changes in InitQuickTimeIfNeeded. Implements Driver.
Definition at line 187 of file qtmidi.cpp.
References _quicktime_started, and InitQuickTimeIfNeeded().
void MusicDriver_QtMidi::Stop | ( | ) | [virtual] |
Stops the MIDI player.
Stops playing and frees any used resources before returning. As it deinitilizes QuickTime, the _quicktime_started flag is set to false
.
Implements Driver.
Definition at line 230 of file qtmidi.cpp.
References _quicktime_movie, _quicktime_started, _quicktime_state, DEBUG, QT_STATE_IDLE, QT_STATE_PLAY, QT_STATE_STOP, and StopSong().