music.c
changeset 12 f38e14b566c8
parent 11 3939a99bf422
child 13 1e489d8b97d8
equal deleted inserted replaced
11:3939a99bf422 12:f38e14b566c8
   399 	if ( music ) {
   399 	if ( music ) {
   400 		/* Caution: If music is playing, mixer will crash */
   400 		/* Caution: If music is playing, mixer will crash */
   401 		if ( music == music_playing && !music_stopped ) {
   401 		if ( music == music_playing && !music_stopped ) {
   402 			if ( music->fading == MIX_FADING_OUT ) {
   402 			if ( music->fading == MIX_FADING_OUT ) {
   403 				/* Wait for the fade out to finish */
   403 				/* Wait for the fade out to finish */
   404 				while(music->fading == MIX_FADING_OUT)
   404 				while(music_playing && !music_stopped && music_playing->fading == MIX_FADING_OUT)
   405 					SDL_Delay(100);
   405 					SDL_Delay(100);
   406 			} else {
   406 			} else {
   407 				Mix_HaltMusic(); /* Stop it immediately */
   407 				Mix_HaltMusic(); /* Stop it immediately */
   408 			}
   408 			}
   409 		}
   409 		}
   668 }
   668 }
   669 
   669 
   670 /* Pause/Resume the music stream */
   670 /* Pause/Resume the music stream */
   671 void Mix_PauseMusic(void)
   671 void Mix_PauseMusic(void)
   672 {
   672 {
   673 	if ( music_playing && !music_stopped ) {
   673 	if ( music_playing && music_active && !music_stopped ) {
   674 		switch ( music_playing->type ) {
   674 		switch ( music_playing->type ) {
   675 #ifdef CMD_MUSIC
   675 #ifdef CMD_MUSIC
   676 		case MUS_CMD:
   676 		case MUS_CMD:
   677 			MusicCMD_Pause(music_playing->data.cmd);
   677 			MusicCMD_Pause(music_playing->data.cmd);
   678 			break;
   678 			break;
   687 	music_active = 0;
   687 	music_active = 0;
   688 }
   688 }
   689 
   689 
   690 void Mix_ResumeMusic(void)
   690 void Mix_ResumeMusic(void)
   691 {
   691 {
   692 	if ( music_playing && !music_stopped ) {
   692 	if ( music_playing && !music_active && !music_stopped ) {
   693 		switch ( music_playing->type ) {
   693 		switch ( music_playing->type ) {
   694 #ifdef CMD_MUSIC
   694 #ifdef CMD_MUSIC
   695 		case MUS_CMD:
   695 		case MUS_CMD:
   696 			MusicCMD_Resume(music_playing->data.cmd);
   696 			MusicCMD_Resume(music_playing->data.cmd);
   697 			break;
   697 			break;