[Solved] Sound playing in one channel prevents sounds...

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
deathzero021
Posts: 55
Joined: Wed Apr 24, 2019 7:36 am
Graphics Processor: nVidia with Vulkan support

[Solved] Sound playing in one channel prevents sounds...

Post by deathzero021 »

I'm having an issue where sound playing on one channel (channel 4) is preventing sounds playing on a different channel (channel 2). The first sound, on channel 4, I'm dedicating to player footstep sounds. So as the player moves, it's constantly playing sounds on that channel. To avoid any issues with this, I decided to make all enemy sounds play on channel 2, so that they would never conflict with each other...

Unfortunately, it's not working as intended. When the player walks, enemy sounds fail to play. Testing this, I have no other sounds playing at all. Just the player and the enemy. If the player is walking, the enemy's attack sound never plays. As soon as I stop walking and thus the footstep sounds don't play, the enemy's attack sound will play.

As far as I can tell, the whole sound channel thing must not work as described in the wiki. It is worth noting that I am playing the footstep sounds through the ACS function "PlaySound" and the enemy sound is being played through the zscript function "A_PlaySound", I also tried "A_StartSound" and got the same results.

Code: Select all

//ACS script for player:
PlaySound(1000, "FTSPSTN1", 4);

Code: Select all

//zscript for enemy:
A_StartSound(MeleeSound, 2);
Also, I tried setting one of them to 0 (auto) and even setting both of them to 0. Still, the same exact problem. As long as a footstep sound is playing, it WON'T play the enemy sound. Perhaps there's a strange relationship between playing sounds in ACS and playing sounds through decorate or zscript? Because if I play a sound on channel 1, which I reserved for player weapon sounds, through ACS, it can play both the footsteps and player weapon sounds at the same time. No issues.

So to summarize the issue, I can't get the enemy sound (being played through zscript) to play while also playing sounds from the player, despite being on different channels...

Edit: Solved! Apparently I'm an idiot and had forgot that the sound playing for the enemy only occurs when they deal melee damage and that their attack state required playing a sound before any damage functions in order to get the initial swing sound for their melee attacks. It had nothing to do with the player's footstep sounds, they enemy was simply missing me when I was strafing LMAO.
Last edited by deathzero021 on Sun Mar 15, 2020 9:26 pm, edited 1 time in total.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Sound playing in one channel prevents sounds in another?

Post by Matt »

[wiki]A_StartSound[/wiki] can take any channel number, so use a channel with some ridiculous number that no one is likely to use.

I'd throw in a CHANF_OVERLAP for good measure.


Replace the ACS footsteps with ZScript ones.
User avatar
deathzero021
Posts: 55
Joined: Wed Apr 24, 2019 7:36 am
Graphics Processor: nVidia with Vulkan support

Re: Sound playing in one channel prevents sounds in another?

Post by deathzero021 »

Matt wrote:[wiki]A_StartSound[/wiki] can take any channel number, so use a channel with some ridiculous number that no one is likely to use.
I'd throw in a CHANF_OVERLAP for good measure.
Replace the ACS footsteps with ZScript ones.
I'll give that a try. I just got done testing having all sounds called through an acs script, and the results are still the same. Enemy sound won't play while footstep sound is. It'll take a bit more work to move all sounds over to zscript though but at this point, I'm willing to try anything just to get this to work.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Sound playing in one channel prevents sounds in another?

Post by Graf Zahl »

These sounds are even on different actors so the channel is totally irrelevant. Of course, with two minimalistic fragments of code it's impossible to say what is wrong. Post the entire footstep sound script, please!
User avatar
deathzero021
Posts: 55
Joined: Wed Apr 24, 2019 7:36 am
Graphics Processor: nVidia with Vulkan support

Re: Sound playing in one channel prevents sounds in another?

Post by deathzero021 »

Graf Zahl wrote:These sounds are even on different actors so the channel is totally irrelevant. Of course, with two minimalistic fragments of code it's impossible to say what is wrong. Post the entire footstep sound script, please!
Alrighty. It's pretty basic right now but here it is:
(tid 1000 = player)
Spoiler:
And the zscript for the enemy is currently just an acs call (though previously i tried A_StartSound):

Code: Select all

CallACS("AttackSounds", 3, 2);
with that script being used for both player and enemy attack sounds:
Spoiler:
Post Reply

Return to “Scripting”