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.
__________________