[Change] Slightly cleaner implementation of channel pause/resume.
This commit is contained in:
parent
3182639db1
commit
846cbd5e35
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "SDL_mixer.h" /** @todo Remove dependency. */
|
||||
|
||||
#include "lephisto.h"
|
||||
#include "pilot.h"
|
||||
@ -2219,8 +2218,7 @@ void player_accelOver(void) {
|
||||
* for pausing/resuming groups in SDL_Mixer.
|
||||
*/
|
||||
void player_soundPause(void) {
|
||||
if(!Mix_Paused(0))
|
||||
Mix_Pause(0);
|
||||
sound_pauseChannel(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2230,8 +2228,7 @@ void player_soundPause(void) {
|
||||
* for pausing/resuming groups in SDL_Mixer.
|
||||
*/
|
||||
void player_soundResume(void) {
|
||||
if(Mix_Paused(0))
|
||||
Mix_Resume(0);
|
||||
sound_resumeChannel(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
22
src/sound.c
22
src/sound.c
@ -726,3 +726,25 @@ static alVoice* voice_get(int id) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pause a channel, should be eliminated to pause groups also.
|
||||
* @param num Channel to pause, not that channel != voice.
|
||||
*/
|
||||
void sound_pauseChannel(int num) {
|
||||
if(sound_disabled) return;
|
||||
|
||||
if(!Mix_Paused(num))
|
||||
Mix_Pause(num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume a channel, should be eliminated to resume groups also.
|
||||
* @param num Channel to resume, not that channel != voice.
|
||||
*/
|
||||
void sound_resumeChannel(int num) {
|
||||
if(sound_disabled) return;
|
||||
|
||||
if(Mix_Paused(num))
|
||||
Mix_Resume(num);
|
||||
}
|
||||
|
||||
|
@ -23,3 +23,7 @@ int sound_createGroup(int tag, int start, int size);
|
||||
int sound_playGroup(int group, int sound, int once);
|
||||
void sound_stopGroup(int group);
|
||||
|
||||
/* Not too portable functions that should be eliminated someday. */
|
||||
void sound_pauseChannel(int num);
|
||||
void sound_resumeChannel(int num);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user