Page 1 of 1

Many sounds on a single channel

Posted: Sun Jan 25, 2015 5:19 pm
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 }

Re: Many sounds on a single channel

Posted: Sun Jan 25, 2015 5:33 pm
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.

Re: Many sounds on a single channel

Posted: Sun Jan 25, 2015 5:35 pm
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.

Re: Many sounds on a single channel

Posted: Sun Jan 25, 2015 5:37 pm
by sonic_HD87
Hellser wrote:...could possibly be done with ACS or something akin to that.
Well, crap. :(

Re: Many sounds on a single channel

Posted: Sun Jan 25, 2015 6:10 pm
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:

Re: Many sounds on a single channel

Posted: Sun Jan 25, 2015 9:54 pm
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

Re: Many sounds on a single channel

Posted: Tue Jan 27, 2015 1:57 am
by Nevander
Don't mean to post something not relevant to the thread, but dude I love your avatar.

Re: Many sounds on a single channel

Posted: Tue Jan 27, 2015 10:37 am
by sonic_HD87
Nevander wrote:Don't mean to post something not relevant to the thread, but dude I love your avatar.
hehe thanks