There would be no change in behaviour with any of my proposed methods. Two would only trigger the new behaviour if the modder specifically requested it, and one would only do it based on the ZScript version or if the modder unset the flag.Graf Zahl wrote:No, that's not possible. The channel parameter has changed its meaning and using the same function would be very, very problematic. In this case the two new functions are the lesser evil, in case of S_Sound it allowed a clean deprecation, in case of A_PlaySound this still requires changing 240 lines of script code before it can be done. But deprecation is preferable to a change in behavior.
CHAN_OVERLAP sound flag
Moderator: GZDoom Developers
- phantombeta
- Posts: 2175
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: CHAN_OVERLAP sound flag
- Major Cooke
- Posts: 8209
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
- Contact:
Re: CHAN_OVERLAP sound flag
This is fantastic stuff Graf!
Small nitpick but wouldn't it make more sense to call S_IsActorPlayingSomething as S_IsActorPlayingSound instead?
Small nitpick but wouldn't it make more sense to call S_IsActorPlayingSomething as S_IsActorPlayingSound instead?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CHAN_OVERLAP sound flag
Yes, that may make sense. The name isn't that great.
- Player701
-
- Posts: 1710
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: CHAN_OVERLAP sound flag
This looks interesting. However, I have another use case: ideally, I'd like to start a new sound on the same channel ONLY if said channel is not already playing this sound. This way, if the sounds are different, they will overlap, but if they are the same, only one instance will play at a time. Or does it already work like that? I'm imagining a ZScript solution to this (that uses multiple channels instead of the new flag) but it looks a little bit hacky to me.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CHAN_OVERLAP sound flag
No, for that you'll have to do a check up front what the channel is playing.
- Marisa the Magician
- Banned User
- 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: CHAN_OVERLAP sound flag
Actually due to the order in which the flags are handled, it'd probably work to just use CHAN_NOSTOP and CHAN_OVERLAP at the same time for the behaviour described.
- Player701
-
- Posts: 1710
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: CHAN_OVERLAP sound flag
Sorry, I've described my use case slightly wrong.
I forgot to add that if the channel IS playing the requested sound, the sound is overridden (i.e. starts playing again). This is how I'd like it to work.Player701 wrote:ideally, I'd like to start a new sound on the same channel ONLY if said channel is not already playing this sound.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CHAN_OVERLAP sound flag
Like I said, in this case you first need to check the channel with the newly added IsActorPlayingSound function and then do different things based on the result.
- Player701
-
- Posts: 1710
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: CHAN_OVERLAP sound flag
Hmm. I've run some tests, and it seems that if CHAN_OVERLAP is not specified, then it always overrides the most recently started sound that is still playing. So I guess I can't implement my use case with only one channel.
In addition, it looks like IsActorPlayingSomething is bugged: if multiple sounds are playing, it will only report true for one of them (which also happens to be the one started most recently), and false for all others. Should I report this?
In addition, it looks like IsActorPlayingSomething is bugged: if multiple sounds are playing, it will only report true for one of them (which also happens to be the one started most recently), and false for all others. Should I report this?
- Marisa the Magician
- Banned User
- 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: CHAN_OVERLAP sound flag
If it's not returning true even if the previous sounds are longer then yes, that's a problem.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: CHAN_OVERLAP sound flag
It may not be the only thing that needs adjustment for CHAN_OVERLAP. The old story: Even simple features often have farther reaching consequences. Let's collect all related issues here.Player701 wrote:Hmm. I've run some tests, and it seems that if CHAN_OVERLAP is not specified, then it always overrides the most recently started sound that is still playing. So I guess I can't implement my use case with only one channel.
In addition, it looks like IsActorPlayingSomething is bugged: if multiple sounds are playing, it will only report true for one of them (which also happens to be the one started most recently), and false for all others. Should I report this?
- Player701
-
- Posts: 1710
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: CHAN_OVERLAP sound flag
Okay, see my report here.