rnd-20010115-1-src
[rocksndiamonds.git] / src / libgame / sound.c
index e038f03aa44d0f142dc1f5b4e32e884207627df2..3e9c7112da72c573e71c8d75ae047e137dc97a24 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2000 Artsoft Entertainment                      *
+* (c) 1994-2001 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -181,6 +181,9 @@ void InitPlaylist(void)
 
 void StartSoundserver(void)
 {
+  if (!audio.sound_available)
+    return;
+
 #if defined(PLATFORM_UNIX) && !defined(TARGET_SDL)
   if (!ForkAudioProcess())
     audio.sound_available = FALSE;
@@ -873,6 +876,9 @@ static boolean LoadSoundExt(char *sound_name, boolean is_music)
   int i;
 #endif
 
+  if (!audio.sound_available)
+    return FALSE;
+
   num_sounds++;
   Sound = checked_realloc(Sound, num_sounds * sizeof(struct SampleInfo));
 
@@ -1000,6 +1006,9 @@ int LoadMusic(void)
   int num_wav_music = 0;
   int num_mod_music = 0;
 
+  if (!audio.sound_available)
+    return 0;
+
   if ((dir = opendir(music_directory)) == NULL)
   {
     Error(ERR_WARN, "cannot read music directory '%s'", music_directory);
@@ -1128,6 +1137,9 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop)
 void FadeMusic(void)
 {
 #if defined(TARGET_SDL)
+  if (!audio.sound_available)
+    return;
+
   if (audio.mods_available)
     Mix_FadeOutMusic(SOUND_FADING_INTERVAL);
   else