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

EmitSoundToClient() and wav sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zynda
Member
Join Date: Jul 2011
Old 07-05-2011 , 17:04   EmitSoundToClient() and wav sounds
Reply With Quote #1

Hello,

So basically i wish to play a wav sound using EmitSoundToClient()
The problem is the sound wont play in-game. I've tried playing a similar sound but in an mp3 format, this works although i really need to keep the sound in an wav format in order for it to loop using cue points.

I wrote this in order to test the sounds.

PHP Code:
// The sound precache part is not included but the sounds are precached in the full version of the script.
public OnPluginStart()
{
      
RegConsoleCmd("say"hook_say);
}

...

public 
Action:hook_say(id,args)
{
    new 
String:SayText[192];
    
GetCmdArgString(SayText,sizeof(SayText));
    
    
StripQuotes(SayText);
    if(
StrEqual(SayText,"!testsound1")) // This dosen't work, nothing is heard in-game.
    
{
        
PrintToChat(id"server/hall.wav");
        
EmitSoundToClient(id"server/hall.wav");
    }
    if(
StrEqual(SayText,"!testsound2")) // This works, the sound is heard in-game.
    
{
        
PrintToChat(id"server/dead.mp3");
        
EmitSoundToClient(id"server/dead.mp3");
    }

The question is, does EmitSoundToClient() even play wav sounds? the sourcemod API was not very clear on this and i haven't found anything searching the forums / google.
Also, Im sure the sound files exists on both the server and my client and i have lowered the quality(decreasing the bitrate) of the sound in order to keep the file size low for downloading.

Thanks for reading and please reply if you have any knowledge or information regarding this.
Zynda is offline
Zynda
Member
Join Date: Jul 2011
Old 07-11-2011 , 13:30   Re: EmitSoundToClient() and wav sounds
Reply With Quote #2

To the top please, i still need some help with this.
Zynda is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 07-11-2011 , 13:53   Re: EmitSoundToClient() and wav sounds
Reply With Quote #3

my experience is that EmitSoundToClient accepts only mp3 files, so does HLDJ (for example).
i might be wrong tho
__________________
napalm00 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-11-2011 , 14:16   Re: EmitSoundToClient() and wav sounds
Reply With Quote #4

Quote:
Originally Posted by napalm00 View Post
my experience is that EmitSoundToClient accepts only mp3 files, so does HLDJ (for example).
i might be wrong tho
The various EmitSound functions accept wav files (and all the sounds included with the game are wav files), but I believe they have to be in a specific format. From memory, 16-bit 11khz, 22khz, or 44khz mono (although stereo may work too) PCM. 48khz sounds will not play.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-11-2011 at 14:21.
Powerlord is offline
Zynda
Member
Join Date: Jul 2011
Old 07-12-2011 , 23:26   Re: EmitSoundToClient() and wav sounds
Reply With Quote #5

Thank you for the info, as the original sounds were in an mp3 format i converted them to wav and lowered the bitrate significantly to keep the file size down. I will try to remake the sound and keep the info you specified in mind. I would also be thankfull if you or someone reading this could confirm the data as it was said to be from his memory.
Zynda is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 07-13-2011 , 04:24   Re: EmitSoundToClient() and wav sounds
Reply With Quote #6

Just move that sound file in your game path:
...game_mod_name/sound/thatsoundfile.wav

Then run your game with console, on menu, type in console:
play "thatsoundfile.wav"

if works, then it work on server.
Rest is sv_pure 1 + pure_server_whitelist.txt and plugin precache...
Bacardi is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 07-13-2011 , 04:31   Re: EmitSoundToClient() and wav sounds
Reply With Quote #7

Quote:
Originally Posted by Zynda View Post
Thank you for the info, as the original sounds were in an mp3 format i converted them to wav and lowered the bitrate significantly to keep the file size down. I will try to remake the sound and keep the info you specified in mind. I would also be thankfull if you or someone reading this could confirm the data as it was said to be from his memory.
you could also use a hidden motd page and play the sounds....
__________________
napalm00 is offline
Zynda
Member
Join Date: Jul 2011
Old 07-14-2011 , 00:37   Re: EmitSoundToClient() and wav sounds
Reply With Quote #8

Quote:
Originally Posted by napalm00 View Post
you could also use a hidden motd page and play the sounds....
How would one do that exactly? Are there any benefits from using that method anyway?
Zynda is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 07-14-2011 , 05:06   Re: EmitSoundToClient() and wav sounds
Reply With Quote #9

Quote:
Originally Posted by Zynda View Post
How would one do that exactly? Are there any benefits from using that method anyway?
This is the plugin : http://forums.alliedmods.net/showthr...ht=hidden+motd

The benefits are that you don't have to force the client to download any file
__________________
napalm00 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 23:25.


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