Augustine: Despondent
Welcome to our Forums! Please login or register! You can introduce yourself here!









Join the forum, it's quick and easy

Augustine: Despondent
Welcome to our Forums! Please login or register! You can introduce yourself here!







Augustine: Despondent
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Augustine: Despondent

Welcome to the forums! We are the homeplace for Slender: Darkplaces, Augustine, Nightfall survival, and Revamped 1.


You are not connected. Please login or register

[Tutorial] Adding sound effects

2 posters

Go down  Message [Page 1 of 1]

1[Tutorial] Adding sound effects Empty [Tutorial] Adding sound effects Tue Jan 11, 2011 6:45 pm

Mexicouger

Mexicouger
Noble
Noble

This tutorial is very basic, and is directed towards newer coders.
First, let's take a look at what a sound function looks like.

sound (self, CHAN_WEAPON, "weapons/ar/fire.wav", 1, ATTN_NORM);

1. Self, is the entity that is playing the sound. If you are calling the FireFunction like W_FireShotgun, then self is whoever is calling that function (In this case, Firing the weapon)

2. CHAN_WEAPON is the channel that the sound effect is on. There are multiple channels, and I would suggest putting different sound effects on different channels. If not, then the entity that is calling the sound will override any other sounds it uses. Let's say you make the jump sound effects CHAN_WEAPON and keep the Fire sound CHAN_WEAPON. Then One of the sounds will stop playing when another is called. So try to put pain sounds and other Player sounds on CHAN_VOICE. Here is the list of the channels.

You can find these definitions of the channels in defs.qc
// sound channels
// channel 0 never willingly overrides
// other channels (1-7) allways override a playing sound on that channel
float CHAN_AUTO = 0;
float CHAN_WEAPON = 1;
float CHAN_VOICE = 2;
float CHAN_ITEM = 3;
float CHAN_BODY = 4;

So those are your channels to work with. Try to put sounds that are played alot on different channels.

3. The string is to show the function where the sound effect is located. That is pretty obvious

4. The value (#1 in this function), is how loud the sound is. It needs to be between 0.0-1.0, or else you will get an error.

5. ATTN_NORM.That is the sound fall off. The farther away you go from the sound, the more it Gets Quieter. Here is the list of them, again, you can find it in defs.qc

float ATTN_NONE = 0; //No fall off. You can hear it anywhere in the level.
float ATTN_NORM = 1; // A decent fall off in Sound/ DEFAULT
float ATTN_IDLE = 2; //Kind of Quiet to hear
float ATTN_STATIC = 3; //Very hard to hear from a ways away.

Then if you are using a new sound effect that isn't In Quake or the mod, then you must precache it so Quake knows what the sound is. A precache looks like this...
precache_sound ("weapons/ar/fire.wav");

You can add this to 2 default locations in the Code.

First, is weapons.qc at the very top in the function void() W_Precache =
Or you can do it in World.qc in the function void() worldspawn =
Doesn't really matter which you do it on. It is all a matter of Choice.

And that wraps this infotutorial up!

-Mexicougr

https://augustine.forumotion.com

2[Tutorial] Adding sound effects Empty Re: [Tutorial] Adding sound effects Wed Jan 12, 2011 4:03 am

thock321

avatar
Hero
Hero

Mexicouger wrote:This tutorial is very basic, and is directed towards newer coders.
First, let's take a look at what a sound function looks like.

sound (self, CHAN_WEAPON, "weapons/ar/fire.wav", 1, ATTN_NORM);

1. Self, is the entity that is playing the sound. If you are calling the FireFunction like W_FireShotgun, then self is whoever is calling that function (In this case, Firing the weapon)

2. CHAN_WEAPON is the channel that the sound effect is on. There are multiple channels, and I would suggest putting different sound effects on different channels. If not, then the entity that is calling the sound will override any other sounds it uses. Let's say you make the jump sound effects CHAN_WEAPON and keep the Fire sound CHAN_WEAPON. Then One of the sounds will stop playing when another is called. So try to put pain sounds and other Player sounds on CHAN_VOICE. Here is the list of the channels.

You can find these definitions of the channels in defs.qc
// sound channels
// channel 0 never willingly overrides
// other channels (1-7) allways override a playing sound on that channel
float CHAN_AUTO = 0;
float CHAN_WEAPON = 1;
float CHAN_VOICE = 2;
float CHAN_ITEM = 3;
float CHAN_BODY = 4;

So those are your channels to work with. Try to put sounds that are played alot on different channels.

3. The string is to show the function where the sound effect is located. That is pretty obvious

4. The value (#1 in this function), is how loud the sound is. It needs to be between 0.0-1.0, or else you will get an error.

5. ATTN_NORM.That is the sound fall off. The farther away you go from the sound, the more it Gets Quieter. Here is the list of them, again, you can find it in defs.qc

float ATTN_NONE = 0; //No fall off. You can hear it anywhere in the level.
float ATTN_NORM = 1; // A decent fall off in Sound/ DEFAULT
float ATTN_IDLE = 2; //Kind of Quiet to hear
float ATTN_STATIC = 3; //Very hard to hear from a ways away.

Then if you are using a new sound effect that isn't In Quake or the mod, then you must precache it so Quake knows what the sound is. A precache looks like this...
precache_sound ("weapons/ar/fire.wav");

You can add this to 2 default locations in the Code.

First, is weapons.qc at the very top in the function void() W_Precache =
Or you can do it in World.qc in the function void() worldspawn =
Doesn't really matter which you do it on. It is all a matter of Choice.

And that wraps this infotutorial up!

-Mexicougr

Nice tut! noob friendly and you explain every part!! rep up! (if i can)

3[Tutorial] Adding sound effects Empty Re: [Tutorial] Adding sound effects Wed Jan 12, 2011 8:06 am

Mexicouger

Mexicouger
Noble
Noble

Thank you very much ^.^

Do you follow these tutorials and actually do them?

https://augustine.forumotion.com

4[Tutorial] Adding sound effects Empty Re: [Tutorial] Adding sound effects Fri Jan 14, 2011 3:56 am

thock321

avatar
Hero
Hero

uhm....no, but if i get interested in coding this is the first place i will goto

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum