added function to check if a certain sound is playing (not used yet)
authorHolger Schemel <info@artsoft.org>
Sat, 10 Feb 2024 20:27:47 +0000 (21:27 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 18 Feb 2024 14:57:40 +0000 (15:57 +0100)
src/libgame/sound.c
src/libgame/sound.h

index f911d2388bf854c9cc372d59d4e64debd6882aaa..5f497c386c56c6dda9088ecfd87940cd3bcfd36c 100644 (file)
@@ -524,6 +524,17 @@ void StartMixer(void)
       (int)sqrt((float)(SOUND_MAX_LEFT2RIGHT * SOUND_MAX_LEFT2RIGHT - i * i));
 }
 
+boolean isSoundPlaying(int nr)
+{
+  int i;
+
+  for (i = audio.first_sound_channel; i < audio.num_channels; i++)
+    if (mixer[i].active && mixer[i].nr == nr)
+      return TRUE;
+
+  return FALSE;
+}
+
 
 // THE STUFF ABOVE IS ONLY USED BY THE SOUND SERVER CHILD PROCESS
 // ============================================================================
index 20852138ca194d9d34b35dd4fcf9a4bad8e28007..8305588db9344fc41865752903707b904c16d625 100644 (file)
@@ -101,6 +101,8 @@ void UnixCloseAudio(void);
 void Mixer_InitChannels(void);
 void StartMixer(void);
 
+boolean isSoundPlaying(int);
+
 // sound client functions
 void PlayMusic(int);
 void PlayMusicLoop(int);