src/music/qtmidi.cpp
changeset 6573 7624f942237f
parent 6443 b8f06d8eb7be
child 6720 35756db7e577
equal deleted inserted replaced
6572:e35266003390 6573:7624f942237f
   171 /**
   171 /**
   172  * Initialize QuickTime if needed. This function sets the
   172  * Initialize QuickTime if needed. This function sets the
   173  * #_quicktime_started flag to @c true if QuickTime is present in the system
   173  * #_quicktime_started flag to @c true if QuickTime is present in the system
   174  * and it was initialized properly.
   174  * and it was initialized properly.
   175  */
   175  */
   176 static void InitQuickTimeIfNeeded(void)
   176 static void InitQuickTimeIfNeeded()
   177 {
   177 {
   178 	OSStatus dummy;
   178 	OSStatus dummy;
   179 
   179 
   180 	if (_quicktime_started) return;
   180 	if (_quicktime_started) return;
   181 
   181 
   205  * Maps OpenTTD volume to QuickTime notion of volume.
   205  * Maps OpenTTD volume to QuickTime notion of volume.
   206  */
   206  */
   207 #define VOLUME  ((short)((0x00FF & _quicktime_volume) << 1))
   207 #define VOLUME  ((short)((0x00FF & _quicktime_volume) << 1))
   208 
   208 
   209 
   209 
   210 static void StopSong(void);
   210 static void StopSong();
   211 
   211 
   212 
   212 
   213 /**
   213 /**
   214  * Initialized the MIDI player, including QuickTime initialization.
   214  * Initialized the MIDI player, including QuickTime initialization.
   215  *
   215  *
   228  * Checks wether the player is active.
   228  * Checks wether the player is active.
   229  *
   229  *
   230  * This function is called at regular intervals from OpenTTD's main loop, so
   230  * This function is called at regular intervals from OpenTTD's main loop, so
   231  * we call @c MoviesTask() from here to let QuickTime do its work.
   231  * we call @c MoviesTask() from here to let QuickTime do its work.
   232  */
   232  */
   233 static bool SongIsPlaying(void)
   233 static bool SongIsPlaying()
   234 {
   234 {
   235 	if (!_quicktime_started) return true;
   235 	if (!_quicktime_started) return true;
   236 
   236 
   237 	switch (_quicktime_state) {
   237 	switch (_quicktime_state) {
   238 		case QT_STATE_IDLE:
   238 		case QT_STATE_IDLE:
   256  * Stops the MIDI player.
   256  * Stops the MIDI player.
   257  *
   257  *
   258  * Stops playing and frees any used resources before returning. As it
   258  * Stops playing and frees any used resources before returning. As it
   259  * deinitilizes QuickTime, the #_quicktime_started flag is set to @c false.
   259  * deinitilizes QuickTime, the #_quicktime_started flag is set to @c false.
   260  */
   260  */
   261 static void StopDriver(void)
   261 static void StopDriver()
   262 {
   262 {
   263 	if (!_quicktime_started) return;
   263 	if (!_quicktime_started) return;
   264 
   264 
   265 	DEBUG(driver, 2, "qtmidi: stopping driver...");
   265 	DEBUG(driver, 2, "qtmidi: stopping driver...");
   266 	switch (_quicktime_state) {
   266 	switch (_quicktime_state) {
   310 
   310 
   311 
   311 
   312 /**
   312 /**
   313  * Stops playing the current song, if the player is active.
   313  * Stops playing the current song, if the player is active.
   314  */
   314  */
   315 static void StopSong(void)
   315 static void StopSong()
   316 {
   316 {
   317 	if (!_quicktime_started) return;
   317 	if (!_quicktime_started) return;
   318 
   318 
   319 	switch (_quicktime_state) {
   319 	switch (_quicktime_state) {
   320 		case QT_STATE_IDLE:
   320 		case QT_STATE_IDLE: