Raised This Month: $32 Target: $400
 8% 

[CSGO] Can't set the volume for EmitSoundToClient()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 08-26-2022 , 16:34   [CSGO] Can't set the volume for EmitSoundToClient()
Reply With Quote #1

I am using this to play sounds to the client with direction and distance information.
It works perfectly for what I am doing but I can't seem to change the volume and I would like to understand the parms for this function better.

1) For the Volume trying different constants like these or numbers doesn't seem to make any difference in the volume.
SNDLEVEL_TRAIN
SNDLEVEL_HELICOPTER
SNDLEVEL_AIRCRAFT

I am using SND_NOFLAGS.
Do I need to change this to SND_CHANGEVOL
to have the SNDLEVEL_* parms have an effect?

2) I am using
SNDCHAN_AUTO
but these are all death sounds from players.
Is SNDCHAN_AUTO the best choice or should I be using something like this instead?
SNDCHAN_VOICE

3) Again ANOTHER parm that seems to be related to volume!
SNDVOL_NORMAL
This is defined as 1.0
Is THIS the parm to change to change the volume?
If not what is this parm used for and what are the allowed values?
Changing it form 1.0 to 2.0 causes NO sounds to be played.

PHP Code:
EmitSoundToClient(client,snd[cSnd],SOUND_FROM_WORLDSNDCHAN_AUTOSNDLEVEL_AIRCRAFTSND_NOFLAGSSNDVOL_NORMALSNDPITCH_NORMAL, -1loc); 
Austin is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 08-26-2022 , 20:22   Re: [CSGO] Can't set the volume for EmitSoundToClient()
Reply With Quote #2

Yes you want to use SND_CHANGEVOL flags.
SNDVOL_NORMAL is just a float value for the volume level, you can set this to 0.5 to play at half volume.
The argument before the soundflags (which you have set to SNDLEVEL_AIRCRAFT) is for the area that the sound will cover and reach to. It is kind of like a radius from the sound source at which the sound will be audible.
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-05-2022 , 00:25   Re: [CSGO] Can't set the volume for EmitSoundToClient()
Reply With Quote #3

It's my understanding that you can't make a sound louder than the original. A way to get around this problem is to play a sound more than once.
PC Gamer is offline
Reply


Thread Tools
Display Modes

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 20:38.


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