AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Some questions about emit_sound (https://forums.alliedmods.net/showthread.php?t=242109)

aron9forever 06-14-2014 05:47

Some questions about emit_sound
 
So here's the dealio, I've created a small menu for terrorists in a jailbreak server to "speak", using a couple of sounds and sound_emit so it's not global but rather coming from the player, which is nice.

here's how it works:

PHP Code:

//menu shows sounds

//choosing from menu plays sound, also creates the speaking spr above the player for 2 seconds
emit_sound(idCHAN_AUTO"sound.wav"0.4ATTN_NORM0PITCH_NORM)

//a task delays the use of the next sound by the same player by 2 seconds, after which the menu is re-opened automatically(spamming still won't work with binds or whatever, the delay stops sounds from playing) 

My questions are:

Should I use one single channel for transmitting sounds? You have to imagine about 10 of these going on at once, and by what I've noticed (but I'm not sure about this) it sometimes interferes with the regular voicecom, and also causes overflows(not even close to sure about this)

What do you think is the best way to make this work? Should I just let it be automatic?
Also, is there any kind of limitations, eg sounds at once per channel, channel specific limitations

PHP Code:

//Sound Channels
#define CHAN_AUTO        0
#define CHAN_WEAPON        1
#define CHAN_VOICE        2
#define CHAN_ITEM        3
#define CHAN_BODY        4
#define CHAN_STREAM        5    //Stream channel from static or dynamic area
#define CHAN_STATIC        6    //Channel from the static area
#define CHAN_NETWORKVOICE_BASE    7    //Voice data coming across the network
#define CHAN_NETWORKVOICE_END    500    //Network voice data reserves slots

//Attenuation values
#define ATTN_NONE        0.00
#define ATTN_NORM        0.80
#define ATTN_IDLE        2.00
#define ATTN_STATIC        1.25

//Pitch values
#define PITCH_NORM        100
#define PITCH_LOW        95
#define PITCH_HIGH        120

//Volume values
#define VOL_NORM        1.0 


Arkshine 06-14-2014 07:18

Re: Some questions about emit_sound
 
- Don't flood client with pointless sound.
- Check if sound should be really emitted (instead of spk)
- Use proper channel depending from where sound is played.
- When you don't know or there is issue, just use AUTO.

aron9forever 06-14-2014 07:28

Re: Some questions about emit_sound
 
Quote:

Originally Posted by Arkshine (Post 2151486)
- Don't flood client with pointless sound.
- Check if sound should be really emitted (instead of spk)
- Use proper channel depending from where sound is played.
- When you don't know or there is issue, just use AUTO.

okay well to answer those:

- It's not exactly pointless, it's not annoying or anything like that, the only problems it might bring are tehnical
- I'm not sure how that check should be done but I'm sure it would take a lot of work. I need all the features of emit sound , direction in space, volume by distance and everything, not only the sound
- please explain

Arkshine 06-14-2014 08:04

Re: Some questions about emit_sound
 
- It was just a a short reminder to keep in mind to think about these details, like "is it really necessary o play such sound". The less burden on the client, the better.
- I think you did not understand me. I was saying before emitting a sound, if it's really worth to do that. Sometimes there are sounds you could play directly on the client. Of course if others need to hear this sound, you should emit it. Both points are just general advice/reminder.
- Nothing complicated. If sound comes from weapon entity, you use _WEAPON, if from player voice, _VOICE, if from some item, _ITEM, etc. If for some reason you have trouble with some sounds, using _AUTO should help most of time.

aron9forever 06-14-2014 09:20

Re: Some questions about emit_sound
 
Quote:

Originally Posted by Arkshine (Post 2151509)
- It was just a a short reminder to keep in mind to think about these details, like "is it really necessary o play such sound". The less burden on the client, the better.
- I think you did not understand me. I was saying before emitting a sound, if it's really worth to do that. Sometimes there are sounds you could play directly on the client. Of course if others need to hear this sound, you should emit it. Both points are just general advice/reminder.
- Nothing complicated. If sound comes from weapon entity, you use _WEAPON, if from player voice, _VOICE, if from some item, _ITEM, etc. If for some reason you have trouble with some sounds, using _AUTO should help most of time.

well since it's supposed to be the players talk, I should use voice right?

Also a side question, since you're really experimented you could help, since I can't find this anywhere
When people speak on their microphones, their model's mouths actually move up and down like they're talking. I haven't seen this in the default CS before, and I suspect it has something to do with the models? I'm not sure

Anyways, do you know how I could make that happen when users emit these sounds?

klippy 06-14-2014 13:12

Re: Some questions about emit_sound
 
Quote:

Originally Posted by aron9forever (Post 2151549)
well since it's supposed to be the players talk, I should use voice right?

Also a side question, since you're really experimented you could help, since I can't find this anywhere
When people speak on their microphones, their model's mouths actually move up and down like they're talking. I haven't seen this in the default CS before, and I suspect it has something to do with the models? I'm not sure

Anyways, do you know how I could make that happen when users emit these sounds?

The mouth is a model controller, it can have up to 4 i think. Well, controller says how much player's mouth should be opened. I may be wrong here, but i think if you emit a sound using a CHAN_VOICE channel(maybe not that one, but one of them) it will automatically open player's mouth.

Arkshine 06-14-2014 13:42

Re: Some questions about emit_sound
 
Yeah, there is a 5th "hidden" controller for mouth, something you can see in .qc "$controller 4 ..."

aron9forever 06-14-2014 13:49

Re: Some questions about emit_sound
 
could any of you guys please give an amxx example of opening mouth, for example?
It can be done, right? :(

Arkshine 06-14-2014 13:57

Re: Some questions about emit_sound
 
DId you read KliPPy's answer?

aron9forever 06-14-2014 16:18

Re: Some questions about emit_sound
 
Quote:

Originally Posted by Arkshine (Post 2151681)
DId you read KliPPy's answer?

not well enough apparently
sorry, lemme check it out


edit::

ok some really funny stuff
so it works ... partially. For some sounds it works, for others it doesn't. I suspect it's the format, because by what I've seen it measures something from the sound, pitch or volume or something, and moves the mouth accordingly .

I guess I'll have to try different formats, 16bit wav at 16000hz mono won't work


All times are GMT -4. The time now is 21:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.