Check if sound is currently playing in a channel

Moderator: GZDoom Developers

User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Check if sound is currently playing in a channel

Post by Apeirogon »

IMO it would be better if "is play sound()" method would return sound id instead of bool.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: Check if sound is currently playing in a channel

Post by Marisa the Magician »

Hm, also, wouldn't it be better if this function was clearscope? it could have its uses on the ui too. Hell, one could even make a close captions mod with that.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Check if sound is currently playing in a channel

Post by Graf Zahl »

Marisa Kirisame wrote:Hm, also, wouldn't it be better if this function was clearscope? it could have its uses on the ui too. Hell, one could even make a close captions mod with that.
Done. I also renamed it.
FEZ_GG
Posts: 5
Joined: Sat Oct 09, 2021 3:52 am

Re: Check if sound is currently playing in a channel

Post by FEZ_GG »

> Hell, one could even make a close captions mod with that.

Apologies for the 4 year bump, but I came across this thread while trying to make a captions mod myself. I had planned to write it in ZScript, but I looked through GZDoom's code and saw the aforementioned S_IsActorPlayingSomething is a C++ function. Is that something that can even be used in ZScript? My initial plan was to have some sort of event listener fire when a sound effect is played, and run code that would display a caption for the sound on the UI, but I wasn't sure if something like that existed.
User avatar
Player701
 
 
Posts: 1640
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Check if sound is currently playing in a channel

Post by Player701 »

FEZ_GG wrote: Sun Dec 31, 2023 3:57 pmIs that something that can even be used in ZScript?
Yes, it can. On the script side, it's called IsActorPlayingSound, and here is the original declaration. The second argument is needed in case you want to check for a specific sound being played, otherwise it will just tell you whether any sound is currently playing or not.

P.S. These posts should probably be split into a separate thread and moved to the scripting subforum. If possible, please post similar questions there next time.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”