AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Metamod:Source Plugins (https://forums.alliedmods.net/forumdisplay.php?f=76)
-   -   VoiceHook - Developer preview of something. (https://forums.alliedmods.net/showthread.php?t=145457)

asherkin 12-16-2010 09:48

VoiceHook - Developer preview of something.
 
7 Attachment(s)
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.

Seta00 12-16-2010 10:31

Re: VoiceHook - Developer preview of something.
 
Needs moar source code :P

berni 12-16-2010 11:43

Re: VoiceHook - Developer preview of something.
 
Sorry, why would someone change the voicedata in a plugin ?

But it sounds great :) I always wanted to do this.

asherkin 12-16-2010 12:01

Re: VoiceHook - Developer preview of something.
 
Quote:

Originally Posted by berni (Post 1372210)
Sorry, why would someone change the voicedata in a plugin ?

A few random ideas that have come up from people:
  • Decrease or increase the volume of a client's voice audio.
  • Pitch-shift it or other audio effects.

I really don't know tbh, it was a requested feature :).

FaTony 12-16-2010 22:57

Re: VoiceHook - Developer preview of something.
 
Sampling rate? How many bits per sample?

raydan 12-16-2010 22:59

Re: VoiceHook - Developer preview of something.
 
use voice audio channel stream mp3?

asherkin 12-16-2010 23:03

Re: VoiceHook - Developer preview of something.
 
Quote:

Originally Posted by FaTony (Post 1372544)
Sampling rate? How many bits per sample?

From voicerecord_ext:
Code:

WAVEFORMATEX g_VoiceSampleFormat =
{
        WAVE_FORMAT_PCM,        // wFormatTag
        1,                        // nChannels
        11025,                        // nSamplesPerSec
        22050,                        // nAvgBytesPerSec
        2,                        // nBlockAlign
        16,                        // wBitsPerSample
        0                        // cbSize
};


FaTony 12-16-2010 23:08

Re: VoiceHook - Developer preview of something.
 
And why no ability to create audio data from scratch? I wanna make my bots talk. :D

asherkin 12-16-2010 23:27

Re: VoiceHook - Developer preview of something.
 
Quote:

Originally Posted by FaTony (Post 1372552)
And why no ability to create audio data from scratch? I wanna make my bots talk. :D

Quote:

Originally Posted by asherkin (Post 1372145)
I'm still working on this heavily

I haven't finished that part yet.

PAL-18 12-17-2010 16:22

Re: VoiceHook - Developer preview of something.
 
Quote:

Originally Posted by asherkin (Post 1372224)
A few random ideas that have come up from people:
  • Decrease or increase the volume of a client's voice audio.
  • Pitch-shift it or other audio effects.

I really don't know tbh, it was a requested feature :).

What about a voice recognition thing where it can pipe the voice to another program and based on what it detects execute server-side commands like ban people for saying the N word.


All times are GMT -4. The time now is 15:48.

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