From a77cc0af29b49cab82fa1380c725b1d14c363c46 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 10 Feb 2024 21:27:47 +0100 Subject: [PATCH] added function to check if a certain sound is playing (not used yet) --- src/libgame/sound.c | 11 +++++++++++ src/libgame/sound.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/libgame/sound.c b/src/libgame/sound.c index f911d238..5f497c38 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -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 // ============================================================================ diff --git a/src/libgame/sound.h b/src/libgame/sound.h index 20852138..8305588d 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -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); -- 2.34.1