Channel flag for Sound properties

Moderator: GZDoom Developers

Post Reply
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Channel flag for Sound properties

Post by Ed the Bat »

Sound properties, such as Inventory.PickupSound, are locked to a single channel. Using this example, there are many instances where I'd like the pickup sound to play on the player's Voice channel instead of the Item channel, as in when the sound I'm using is a voice sample. When it plays on the Item channel, it can often overlap with bytes playing on the voice channel, which sounds stupid. I'd like to be able to just have it play on the Voice channel in the first place without employing ugly hacks and workarounds.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: Channel flag for Sound properties

Post by The Zombie Killer »

User avatar
Fishytza
Posts: 793
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: Channel flag for Sound properties

Post by Fishytza »

I think you missed a spot:
In AActor::PlayActiveSound(), in p_mobj.cpp

Code: Select all

    if (ActiveSound && !S_IsActorPlayingSomething (this, CHAN_VOICE, -1))
But shouldn't it be:

Code: Select all

    if (ActiveSound && !S_IsActorPlayingSomething (this, ActiveSoundChannel, -1))
?

Also, I'm not entirely sure if this will cause compatibility issues considering that for the most part the SeeSound is played on CHAN_VOICE and AttackSound on CHAN_WEAPON with the exception of P_SpawnPuff() which plays both sounds on CHAN_BODY.

....
Digging further I noticed you missed/omitted A_Look(Ex) (<- plays SeeSound on CHAN_VOICE). Is this intentional?

There might be other places I missed; I don't have time at the moment.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: Channel flag for Sound properties

Post by The Zombie Killer »

I did it rather quick so those are definitely not intentional. I'll fix 'em up now.
User avatar
Fishytza
Posts: 793
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: They/Them
Contact:

Re: Channel flag for Sound properties

Post by Fishytza »

Um, hate to say it, but I think you missed the old-fashioned A_Look.

Also, one thing which seems a bit problematic:
p_mobj.cpp, P_PlaySpawnSound:

Code: Select all

        if (!(missile->flags & MF_SPAWNSOUNDSOURCE))
        {
            S_Sound (missile, missile->SeeSoundChannel, missile->SeeSound, 1, ATTN_NORM);
        }
        else if (spawner != NULL)
        {
            S_Sound (spawner, spawner->SeeSoundChannel, missile->SeeSound, 1, ATTN_NORM);
        }
Originally, it looked like this:

Code: Select all

        if (!(missile->flags & MF_SPAWNSOUNDSOURCE))
        {
            S_Sound (missile, CHAN_VOICE, missile->SeeSound, 1, ATTN_NORM);
        }
        else if (spawner != NULL)
        {
            S_Sound (spawner, CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
        }
The problem I have with this is, as you can see, when the missile's SeeSound is supposed to be played on the owner (spawner), it was played on CHAN_WEAPON so as to not interrupt the owner's ActiveSound. But now with the new "flexible sound channels" it will play the missile's SeeSound on the owner's CHAN_VOICE which traditionally is used by the ActiveSound (which is randomly played by A_Chase).

The reason I mention this is because some Heretic and Hexen monsters' missiles do make use of the SPAWNSOUNDSOURCE flag. In other words, it will cause compatibility issues.

Unfortunately, I can't think of a clean way to resolve this at the moment.

The two stupid/hacky/ugly/shitty ideas I have are:
1) If using SPAWNSOUNDSOURCE, play the missile's SeeSound on the owner's AttackSoundChannel (since that defaults to CHAN_WEAPON).

2) Let SPAWNSOUNDSOURCE use the hardcoded CHAN_WEAPON and have a new actor flag (Eg. SPAWNSOUNDSOURCECNL) play the missile's SeeSound on the owner's SeeSoundChannel.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Channel flag for Sound properties

Post by Graf Zahl »

SPAWNSOUNDSOURCE absolutely cannot use these new properties because the sound is played on an entirely different actor.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”