Many sounds on a single channel

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
sonic_HD87
Posts: 287
Joined: Sat Mar 23, 2013 4:32 pm
Location: Venezuela

Many sounds on a single channel

Post by sonic_HD87 »

I'm using a voice sound that play when an enemy enter on XDeath state, the problem is that the voice sound has 4 different sentences and i want it to play 1 of those senteces when i kill 5 zombiemans instead of hearing all of them at the same time.

To avoid it i saw on the Wiki that playing a sound on a channel overrides any sound playing on the same channel, so i was thinking to use the voice sound on the same channel so the old sound (with the sentence X) is 'erased' and the new sound (with the sentence Y) is heard instead of hearing the old and new (Sentence X and Y) together.

I've tried it and i have no luck, even if i put CHAN_VOICE instead of an integer value both old and new sound are heard together, causing an echo or inconsistencies on the sentences.

I give the code if anyone can help

Here's the code of the Decorate lump

Code: Select all

actor MK_ShotgunGuy: ShotgunGuy replaces ShotgunGuy
{
 damagefactor "BFGBall", 10.0
 damagefactor "Rocket", 5.0
 states
 {
  XDeath:
   SPOS M 0
   SPOS MM 0 A_SpawnItemEx("XtremeBlood",0,0,20,0,0,0,0)
   SPOS M 5
   SPOS N 5 A_XScream
   SPOS O 5 A_NoBlocking
   SPOS PQRST 5
   SPOS U -1 A_PlaySound("Fatality",CHAN_VOICE|CHAN_NOPAUSE,2.5,false,ATTN_NONE)
  Stop
 }
}
Here's the code of the SNDINFO lump

Code: Select all

FATA1 FATAL1  //Shao Khan voices: "Fatality"
FATA2 FATAL2  //"Excellent"
FATA3 FATAL3  //"Outstanding"
FATA4 FATAL4  //"Well Done"

$random FATALITY { FATA1 FATA2 FATA3 FATA4 }
User avatar
Hellser
Global Moderator
Posts: 2787
Joined: Sun Jun 25, 2006 4:43 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Citadel Station

Re: Many sounds on a single channel

Post by Hellser »

Problem is, each actor has their own channel. What you're looking for could possibly be done with ACS or something akin to that.
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: Many sounds on a single channel

Post by Graf Zahl »

Channels are per actor, so each of your Zombiemen plays its own sound.

You'll have to play around with $limit or $singular to restrict how many instances of each sound can be heard.
User avatar
sonic_HD87
Posts: 287
Joined: Sat Mar 23, 2013 4:32 pm
Location: Venezuela

Re: Many sounds on a single channel

Post by sonic_HD87 »

Hellser wrote:...could possibly be done with ACS or something akin to that.
Well, crap. :(
User avatar
sonic_HD87
Posts: 287
Joined: Sat Mar 23, 2013 4:32 pm
Location: Venezuela

Re: Many sounds on a single channel

Post by sonic_HD87 »

Graf Zahl wrote:Channels are per actor, so each of your Zombiemen plays its own sound.

You'll have to play around with $limit or $singular to restrict how many instances of each sound can be heard.
I've use them with 1 sound sentence and works as expected but doesn't work with $random, i guess i have to use only 1. :roll:
User avatar
sonic_HD87
Posts: 287
Joined: Sat Mar 23, 2013 4:32 pm
Location: Venezuela

Re: Many sounds on a single channel

Post by sonic_HD87 »

After learning some ACS i manage to fix it, i hope someone find it useful

Code: Select all

bool Very=False;

Script 999 (void)
{
 if (Very==False) 
 {
  very=true;
  PlaySound(0,"FATALITY","CHAN_BODY",2.0,0,0);
  delay(35*2);
  very=false;
 }
}
If "very" is true means that the sound is being played, when it finish it turns to false so it can be used again
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Many sounds on a single channel

Post by Nevander »

Don't mean to post something not relevant to the thread, but dude I love your avatar.
User avatar
sonic_HD87
Posts: 287
Joined: Sat Mar 23, 2013 4:32 pm
Location: Venezuela

Re: Many sounds on a single channel

Post by sonic_HD87 »

Nevander wrote:Don't mean to post something not relevant to the thread, but dude I love your avatar.
hehe thanks
Locked

Return to “Editing (Archive)”