Raised This Month: $ Target: $400
 0% 

Some questions about emit_sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-14-2014 , 05:47   Some questions about emit_sound
Reply With Quote #1

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 
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-14-2014 , 07:18   Re: Some questions about emit_sound
Reply With Quote #2

- 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.
__________________
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-14-2014 , 07:28   Re: Some questions about emit_sound
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
- 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
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-14-2014 , 08:04   Re: Some questions about emit_sound
Reply With Quote #4

- 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.
__________________
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-14-2014 , 09:20   Re: Some questions about emit_sound
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
- 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?
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-14-2014 , 13:12   Re: Some questions about emit_sound
Reply With Quote #6

Quote:
Originally Posted by aron9forever View Post
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.
klippy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-14-2014 , 13:42   Re: Some questions about emit_sound
Reply With Quote #7

Yeah, there is a 5th "hidden" controller for mouth, something you can see in .qc "$controller 4 ..."
__________________
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-14-2014 , 13:49   Re: Some questions about emit_sound
Reply With Quote #8

could any of you guys please give an amxx example of opening mouth, for example?
It can be done, right?
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-14-2014 , 13:57   Re: Some questions about emit_sound
Reply With Quote #9

DId you read KliPPy's answer?
__________________
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 06-14-2014 , 16:18   Re: Some questions about emit_sound
Reply With Quote #10

Quote:
Originally Posted by Arkshine View Post
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
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 06-14-2014 at 16:33.
aron9forever is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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