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 */
static long max_sample_size = 0;
static long fragment_size = DEFAULT_AUDIO_FRAGMENT_SIZE;
int sample_rate = DEFAULT_AUDIO_SAMPLE_RATE;
- boolean stereo = TRUE;
+ static boolean stereo = TRUE;
if (playing_sounds ||
(audio.device_fd = OpenAudioDevice(audio.device_name)) >= 0)
{
char *filename = dir_entry->d_name;
- if (strlen(filename) > 4 &&
- strcmp(&filename[strlen(filename) - 4], ".wav") == 0)
- {
- if (LoadSoundExt(filename, TRUE))
- num_wav_music++;
- }
- else if (strlen(filename) > 4 &&
- (strcmp(&filename[strlen(filename) - 4], ".mod") == 0 ||
- strcmp(&filename[strlen(filename) - 4], ".MOD") == 0 ||
- strncmp(filename, "mod.", 4) == 0 ||
- strncmp(filename, "MOD.", 4) == 0))
- {
- if (LoadMod(filename))
- num_mod_music++;
- }
+ if (FileIsSound(filename) && LoadSoundExt(filename, TRUE))
+ num_wav_music++;
+ else if (FileIsMusic(filename) && LoadMod(filename))
+ num_mod_music++;
}
closedir(dir);
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");