OpenTTD
|
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. |
Additional Inherited Members | |
![]() | |
enum | Type { DT_BEGIN = 0, DT_MUSIC = 0, DT_SOUND, DT_VIDEO, DT_END } |
The type of driver. More... | |
![]() | |
static MusicDriver * | GetInstance () |
Get the currently active instance of the music driver. |
|
inlinevirtual |
|
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 202 of file qtmidi.cpp.
References _quicktime_movie, _quicktime_started, _quicktime_state, QT_STATE_IDLE, QT_STATE_PLAY, and QT_STATE_STOP.
|
virtual |
Starts playing a new song.
filename | Path to a MIDI file. |
Implements MusicDriver.
Definition at line 261 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.
|
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 321 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.
|
virtual |
Initialized the MIDI player, including QuickTime initialization.
Gestalt()
and EnterMovies()
. Needs changes in InitQuickTimeIfNeeded. Implements Driver.
Definition at line 189 of file qtmidi.cpp.
References _quicktime_started, and InitQuickTimeIfNeeded().
|
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 232 of file qtmidi.cpp.
References _quicktime_movie, _quicktime_started, _quicktime_state, DEBUG, QT_STATE_IDLE, QT_STATE_PLAY, QT_STATE_STOP, and StopSong().