X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsound.c;h=92c2253c81acad8581b67d82c9dec25e0f16bca5;hb=e849e67ceff4a2f5d457dedee8f18de1646b9dc3;hp=d10f0f2b7f94a6f3f286602e9f45eb7b3e59eba9;hpb=909a0a4d74f274b5c05c16cf595b235aa092fc9a;p=rocksndiamonds.git diff --git a/src/libgame/sound.c b/src/libgame/sound.c index d10f0f2b..92c2253c 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -135,7 +135,7 @@ static boolean ForkAudioProcess(void) return FALSE; } - if (audio.soundserver_pid == 0) /* we are child */ + if (audio.soundserver_pid == 0) /* we are child process */ { SoundServer(); @@ -168,7 +168,7 @@ void UnixCloseAudio(void) if (audio.device_fd) close(audio.device_fd); - if (audio.soundserver_pid) + if (audio.soundserver_pid > 0) /* we are parent process */ kill(audio.soundserver_pid, SIGTERM); } #endif /* PLATFORM_UNIX */ @@ -1169,6 +1169,9 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop) Mix_Volume(-1, SOUND_MAX_VOLUME); Mix_PlayChannel(-1, Sound[nr].mix_chunk, (loop ? -1 : 0)); #elif defined(PLATFORM_UNIX) + if (audio.soundserver_pid == 0) /* we are child process */ + return; + if (write(audio.soundserver_pipe[1], &snd_ctrl, sizeof(snd_ctrl)) < 0) { Error(ERR_WARN, "cannot pipe to child process -- no sounds"); @@ -1274,6 +1277,9 @@ void StopSoundExt(int nr, int method) #else #if !defined(PLATFORM_MSDOS) + if (audio.soundserver_pid == 0) /* we are child process */ + return; + if (write(audio.soundserver_pipe[1], &snd_ctrl, sizeof(snd_ctrl)) < 0) { Error(ERR_WARN, "cannot pipe to child process -- no sounds");