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

VoiceHook - Developer preview of something.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-16-2010 , 09:48   VoiceHook - Developer preview of something.
Reply With Quote #1

This plugin hooks the broadcast of voice chat through the server, decompresses it with Valve's audio codecs, passes it onto other plugins that have registered a listener and then re-compresses the data.

WARNING: For TF2 and other games using the Steam audio system, you need to set the sv_use_steam_voice convar to 0 if you want decompression to work.

The interface is quite simple:
Code:
#define VOICE_INTERFACE "VOICE_INTERFACE_002"

class IVoiceListener
{
public:
	// In raw mode, nSamples = bytes;
	virtual void OnVoiceBroadcast(int client, char *pVoiceData, int *nSamples)
	{
	}
};

class IVoice
{
public:
	virtual void AddVoiceListener(IVoiceListener *pVoiceListener) = 0;
	virtual void RemoveVoiceListener(IVoiceListener *pVoiceListener) = 0;
	
	virtual void AddRawVoiceListener(IVoiceListener *pVoiceListener) = 0;
	virtual void RemoveRawVoiceListener(IVoiceListener *pVoiceListener) = 0;
};
and can be acquired with the following code:
Code:
IVoice *pVoice = (IVoice *)g_SMAPI->MetaFactory(VOICE_INTERFACE, NULL, NULL);
I'm fed up with typing, so have a load of files:
You'll need to copy vaudio_speex.dll from Steam\steamapps\<account name>\<Source 2009 using game name>\bin\ (Linux users can get the Linux one from here) and copy it to orangebox\bin in your server install.

TO-DO List:
  • Further reverse engineer the broadcast function, if it can be completely replaced we'll be able to avoid the terrible voice management functions.
  • Allow interface implementors to block the function.
  • Implement a method to get IServer, so we can broadcast arbitrary audio to clients.
__________________

Last edited by asherkin; 03-23-2013 at 01:32.
asherkin is offline
 


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 03:30.


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