return FALSE;
}
- if (audio.soundserver_pid == 0) /* we are child */
+ if (audio.soundserver_pid == 0) /* we are child process */
{
SoundServer();
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 */
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");
#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");
audio.sound_enabled = FALSE;
audio.soundserver_pipe[0] = audio.soundserver_pipe[1] = 0;
- audio.soundserver_pid = 0;
+ audio.soundserver_pid = -1;
audio.device_name = NULL;
audio.device_fd = 0;