From: Holger Schemel Date: Sat, 10 Feb 2024 20:27:47 +0000 (+0100) Subject: added function to check if a certain sound is playing (not used yet) X-Git-Tag: 4.4.0.0-test-1~412 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a77cc0af29b49cab82fa1380c725b1d14c363c46;p=rocksndiamonds.git added function to check if a certain sound is playing (not used yet) --- 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);