boolean picture_with_mask;
};
-#ifndef TARGET_SDL
-static int sound_process_id = 0;
-#endif
-
static void InitPlayerInfo(void);
static void InitLevelInfo(void);
static void InitNetworkServer(void);
{
int i;
- if (sound_status == SOUND_OFF)
- return;
-
-#if defined(TARGET_SDL)
- if (InitAudio())
- {
- sound_status = SOUND_AVAILABLE;
- sound_loops_allowed = TRUE;
- }
- else
- {
- sound_status = SOUND_OFF;
- }
-#else /* !TARGET_SDL */
-
-#if defined(PLATFORM_UNIX)
- if ((sound_status = CheckAudio(sound_device_name)) == SOUND_OFF)
- return;
-
-#ifdef VOXWARE
- sound_loops_allowed = TRUE;
-#endif
-
-#else /* !PLATFORM_UNIX */
- sound_loops_allowed = TRUE;
-
-#endif /* !PLATFORM_UNIX */
-#endif /* !TARGET_SDL */
+ OpenAudio(&audio);
for(i=0; i<NUM_SOUNDS; i++)
{
if (!LoadSound(&Sound[i]))
{
- sound_status = SOUND_OFF;
- sound_loops_allowed = FALSE;
+ audio.sound_available = FALSE;
+ audio.loops_available = FALSE;
return;
}
}
void InitSoundServer()
{
- if (sound_status == SOUND_OFF)
+ if (!audio.sound_available)
return;
#if !defined(TARGET_SDL)
#if defined(PLATFORM_UNIX)
- if (pipe(sound_pipe)<0)
+ if (pipe(audio.soundserver_pipe) < 0)
{
Error(ERR_WARN, "cannot create pipe - no sounds");
- sound_status = SOUND_OFF;
+ audio.sound_available = FALSE;
return;
}
- if ((sound_process_id = fork()) < 0)
+ if ((audio.soundserver_pid = fork()) < 0)
{
Error(ERR_WARN, "cannot create sound server process - no sounds");
- sound_status = SOUND_OFF;
+ audio.sound_available = FALSE;
return;
}
- if (!sound_process_id) /* we are child */
+ if (audio.soundserver_pid == 0) /* we are child */
{
SoundServer();
/* never reached */
exit(0);
}
- else /* we are parent */
- close(sound_pipe[0]); /* no reading from pipe needed */
+ else /* we are parent */
+ close(audio.soundserver_pipe[0]); /* no reading from pipe needed */
#else /* !PLATFORM_UNIX */
StopSounds();
FreeSounds(NUM_SOUNDS);
#else
- if (sound_process_id)
+ if (audio.soundserver_pid)
{
StopSounds();
- kill(sound_process_id, SIGTERM);
+ kill(audio.soundserver_pid, SIGTERM);
FreeSounds(NUM_SOUNDS);
}
#endif