[Solved] Sounds on the same channel always get cut off

Post bugs that have to do with sound and/or in-game music here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

[Solved] Sounds on the same channel always get cut off

Postby Cherno » Tue Oct 13, 2020 11:00 am

It seems like you can't prevent playing a sound on a channel to cut off a sound that is already playing on the same channel.

Example case:
Your minigun has a looping fire state where you want to play a looping firing sound, but only if the sound is not already being played on the channel.

using A_StartSound with CHANF_LOOPING (which means CHANF_LOOP and CHANF_NOSTOP), or just CHANF_NOSTOP, makes no difference; the sound already playing on the channel will always be cut off.

I constructed a simple showcase. Just load it with Doom.wad or Doom2.wad, summon the "Test" actor, and hear the shotgun sound being cut off by the pistol sound.

gzlooptest.pk3
You do not have the required permissions to view the files attached to this post.
Last edited by Cherno on Wed Oct 14, 2020 7:41 am, edited 1 time in total.
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: Sounds on the same channel always get cut off (CHANF_NOS

Postby Player701 » Wed Oct 14, 2020 3:12 am

It seems that CHANF_NOSTOP only works if an actor is already playing the same sound that A_StartSound wants to play. Not sure if this is a bug or by design. The wiki seems to suggest the former, though. But do note that it's been like that at since at least 4.3.1.

Addendum: The article for A_PlaySound claims (emphasis mine):
ZDoom Wiki wrote:CHAN_NOSTOP (4096) — Do not override the sound that is currently playing on the same channel with this one. This is only the case if both sounds are the same. If they are different, the playing sound is overridden regardless.

However, A_StartSound instead says:
ZDoom Wiki wrote:CHANF_NOSTOP — if the channel is occupied, do not play the sound

Since the A_PlaySound article was written first, I assume that this is isn't a bug but intended behavior.
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: Sounds on the same channel always get cut off (CHANF_NOS

Postby Graf Zahl » Wed Oct 14, 2020 5:00 am

"Written first" is meaningless. "Changed most recently" is more important. It may be that somebody edited the A_PlaySound page but forgot A_StartSound.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Sounds on the same channel always get cut off (CHANF_NOS

Postby Player701 » Wed Oct 14, 2020 5:09 am

CHANF_NOSTOP was added to the A_PlaySound article about 2.5 years ago by Blue Shadow. A_StartSound didn't exist at that time.

And it was none other than you, Graf, who added that flag, among a few others, to the A_StartSound article in January this year. Note that the description was already incorrect back then, and no one has edited it since.
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: Sounds on the same channel always get cut off (CHANF_NOS

Postby Cherno » Wed Oct 14, 2020 7:37 am

Thanks for the clarification. I only use A_Startsound nowadays so I didn't know about that crucial bit of info :)

Anyway, to get the behavior I wanted, I simply used IsActorPlayingSound to check if the sound is already playing.
User avatar
Cherno
 
Joined: 06 Dec 2016


Return to Audio/Music Bugs

Who is online

Users browsing this forum: No registered users and 0 guests