Check if sound is currently playing in a channel
Moderator: GZDoom Developers
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Check if sound is currently playing in a channel
IMO it would be better if "is play sound()" method would return sound id instead of bool.
-
- 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
Re: Check if sound is currently playing in a channel
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.
-
- Lead GZDoom+Raze Developer
- Posts: 49190
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Check if sound is currently playing in a channel
Done. I also renamed it.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.
-
- Posts: 5
- Joined: Sat Oct 09, 2021 3:52 am
Re: Check if sound is currently playing in a channel
> 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.
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.
-
-
- Posts: 1694
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: Check if sound is currently playing in a channel
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.