[Added] CHAN_OVERLAP sound flag

Moderator: GZDoom Developers

Re: CHAN_OVERLAP sound flag

Postby phantombeta » Mon Dec 16, 2019 5:37 pm

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.

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.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: Brazil, South America, Earth, Orion-Cygnus Arm, Milky Way
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: CHAN_OVERLAP sound flag

Postby Major Cooke » Mon Dec 16, 2019 6:20 pm

This is fantastic stuff Graf!
Small nitpick but wouldn't it make more sense to call S_IsActorPlayingSomething as S_IsActorPlayingSound instead?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: CHAN_OVERLAP sound flag

Postby Graf Zahl » Tue Dec 17, 2019 12:58 am

Yes, that may make sense. The name isn't that great.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: CHAN_OVERLAP sound flag

Postby Player701 » Tue Dec 17, 2019 2:45 am

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.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: CHAN_OVERLAP sound flag

Postby Graf Zahl » Tue Dec 17, 2019 2:53 am

No, for that you'll have to do a check up front what the channel is playing.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: CHAN_OVERLAP sound flag

Postby Marisa Kirisame » Tue Dec 17, 2019 2:57 am

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.
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: CHAN_OVERLAP sound flag

Postby Player701 » Tue Dec 17, 2019 2:58 am

Sorry, I've described my use case slightly wrong.
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.

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.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: CHAN_OVERLAP sound flag

Postby Graf Zahl » Tue Dec 17, 2019 3:00 am

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: CHAN_OVERLAP sound flag

Postby Player701 » Tue Dec 17, 2019 3:27 am

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?
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: CHAN_OVERLAP sound flag

Postby Marisa Kirisame » Tue Dec 17, 2019 4:27 am

If it's not returning true even if the previous sounds are longer then yes, that's a problem.
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: CHAN_OVERLAP sound flag

Postby Graf Zahl » Tue Dec 17, 2019 4:45 am

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?


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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: CHAN_OVERLAP sound flag

Postby Player701 » Tue Dec 17, 2019 4:52 am

Okay, see my report here.
User avatar
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Previous

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests