Tweaks for voicechat:
Added cl_voip_test cvar, so you can hear/test yourself. Added potential support for opus. audio ducking autogain switched off by default. its nice for pure speech but shite for push-to-talk, voice activation, or indeed anything else. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4375 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
95188faec2
commit
df22ebd757
3 changed files with 625 additions and 277 deletions
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
unsigned int outlimit;
|
unsigned int outlimit;
|
||||||
int *p;
|
int *p;
|
||||||
int val;
|
int val;
|
||||||
int snd_vol;
|
// int snd_vol;
|
||||||
short *pbuf;
|
short *pbuf;
|
||||||
int i, numc;
|
int i, numc;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
count = (endtime - sc->paintedtime) * sc->sn.numchannels;
|
count = (endtime - sc->paintedtime) * sc->sn.numchannels;
|
||||||
outlimit = sc->sn.samples;
|
outlimit = sc->sn.samples;
|
||||||
out_idx = (sc->paintedtime * sc->sn.numchannels) % outlimit;
|
out_idx = (sc->paintedtime * sc->sn.numchannels) % outlimit;
|
||||||
snd_vol = (volume.value*voicevolumemod)*256;
|
// snd_vol = (volume.value*voicevolumemod)*256;
|
||||||
numc = sc->sn.numchannels;
|
numc = sc->sn.numchannels;
|
||||||
|
|
||||||
pbuf = sc->Lock(sc, &out_idx);
|
pbuf = sc->Lock(sc, &out_idx);
|
||||||
|
@ -58,7 +58,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
{
|
{
|
||||||
for (i = 0; i < numc; i++)
|
for (i = 0; i < numc; i++)
|
||||||
{
|
{
|
||||||
val = (*p * snd_vol) >> 8;
|
val = *p;// * snd_vol) >> 8;
|
||||||
p++;
|
p++;
|
||||||
if (val > 0x7fff)
|
if (val > 0x7fff)
|
||||||
val = 0x7fff;
|
val = 0x7fff;
|
||||||
|
@ -78,7 +78,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
{
|
{
|
||||||
for (i = 0; i < numc; i++)
|
for (i = 0; i < numc; i++)
|
||||||
{
|
{
|
||||||
val = (*p * snd_vol) >> 8;
|
val = *p;// * snd_vol) >> 8;
|
||||||
p++;
|
p++;
|
||||||
if (val > 0x7fff)
|
if (val > 0x7fff)
|
||||||
val = 0x7fff;
|
val = 0x7fff;
|
||||||
|
@ -289,11 +289,6 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
int i;
|
int i;
|
||||||
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
||||||
|
|
||||||
if (ch->vol[0] > 255)
|
|
||||||
ch->vol[0] = 255;
|
|
||||||
if (ch->vol[1] > 255)
|
|
||||||
ch->vol[1] = 255;
|
|
||||||
|
|
||||||
if (ch->rate != (1<<PITCHSHIFT))
|
if (ch->rate != (1<<PITCHSHIFT))
|
||||||
{
|
{
|
||||||
sfx = (signed char *)sc->data;
|
sfx = (signed char *)sc->data;
|
||||||
|
@ -324,11 +319,6 @@ void SND_PaintChannelFrom8Stereo (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
int i;
|
int i;
|
||||||
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
||||||
|
|
||||||
if (ch->vol[0] > 255)
|
|
||||||
ch->vol[0] = 255;
|
|
||||||
if (ch->vol[1] > 255)
|
|
||||||
ch->vol[1] = 255;
|
|
||||||
|
|
||||||
if (ch->rate != (1<<PITCHSHIFT))
|
if (ch->rate != (1<<PITCHSHIFT))
|
||||||
{
|
{
|
||||||
sfx = (signed char *)sc->data;
|
sfx = (signed char *)sc->data;
|
||||||
|
@ -356,15 +346,6 @@ void SND_PaintChannelFrom8_4Speaker (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
int i;
|
int i;
|
||||||
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
||||||
|
|
||||||
if (ch->vol[0] > 255)
|
|
||||||
ch->vol[0] = 255;
|
|
||||||
if (ch->vol[1] > 255)
|
|
||||||
ch->vol[1] = 255;
|
|
||||||
if (ch->vol[2] > 255)
|
|
||||||
ch->vol[2] = 255;
|
|
||||||
if (ch->vol[3] > 255)
|
|
||||||
ch->vol[3] = 255;
|
|
||||||
|
|
||||||
if (ch->rate != (1<<PITCHSHIFT))
|
if (ch->rate != (1<<PITCHSHIFT))
|
||||||
{
|
{
|
||||||
signed char data;
|
signed char data;
|
||||||
|
@ -398,19 +379,6 @@ void SND_PaintChannelFrom8_6Speaker (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
int i;
|
int i;
|
||||||
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
||||||
|
|
||||||
if (ch->vol[0] > 255)
|
|
||||||
ch->vol[0] = 255;
|
|
||||||
if (ch->vol[1] > 255)
|
|
||||||
ch->vol[1] = 255;
|
|
||||||
if (ch->vol[2] > 255)
|
|
||||||
ch->vol[2] = 255;
|
|
||||||
if (ch->vol[3] > 255)
|
|
||||||
ch->vol[3] = 255;
|
|
||||||
if (ch->vol[4] > 255)
|
|
||||||
ch->vol[4] = 255;
|
|
||||||
if (ch->vol[5] > 255)
|
|
||||||
ch->vol[5] = 255;
|
|
||||||
|
|
||||||
if (ch->rate != (1<<PITCHSHIFT))
|
if (ch->rate != (1<<PITCHSHIFT))
|
||||||
{
|
{
|
||||||
signed char data;
|
signed char data;
|
||||||
|
@ -448,23 +416,6 @@ void SND_PaintChannelFrom8_8Speaker (channel_t *ch, sfxcache_t *sc, int count)
|
||||||
int i;
|
int i;
|
||||||
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
unsigned int pos = ch->pos-(sc->soundoffset<<PITCHSHIFT);
|
||||||
|
|
||||||
if (ch->vol[0] > 255)
|
|
||||||
ch->vol[0] = 255;
|
|
||||||
if (ch->vol[1] > 255)
|
|
||||||
ch->vol[1] = 255;
|
|
||||||
if (ch->vol[2] > 255)
|
|
||||||
ch->vol[2] = 255;
|
|
||||||
if (ch->vol[3] > 255)
|
|
||||||
ch->vol[3] = 255;
|
|
||||||
if (ch->vol[4] > 255)
|
|
||||||
ch->vol[4] = 255;
|
|
||||||
if (ch->vol[5] > 255)
|
|
||||||
ch->vol[5] = 255;
|
|
||||||
if (ch->vol[6] > 255)
|
|
||||||
ch->vol[6] = 255;
|
|
||||||
if (ch->vol[7] > 255)
|
|
||||||
ch->vol[7] = 255;
|
|
||||||
|
|
||||||
if (ch->rate != (1<<PITCHSHIFT))
|
if (ch->rate != (1<<PITCHSHIFT))
|
||||||
{
|
{
|
||||||
signed char data;
|
signed char data;
|
||||||
|
|
|
@ -83,14 +83,15 @@ typedef struct
|
||||||
|
|
||||||
#define PITCHSHIFT 6 /*max audio file length = (1<<32>>PITCHSHIFT)/KHZ*/
|
#define PITCHSHIFT 6 /*max audio file length = (1<<32>>PITCHSHIFT)/KHZ*/
|
||||||
|
|
||||||
|
#define CF_ABSVOLUME 1 // ignores volume cvar.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
sfx_t *sfx; // sfx number
|
sfx_t *sfx; // sfx number
|
||||||
int vol[MAXSOUNDCHANNELS]; // 0-255 volume
|
int vol[MAXSOUNDCHANNELS]; // volume, .8 fixed point.
|
||||||
// int delay[MAXSOUNDCHANNELS];
|
|
||||||
int start; // start time in global paintsamples
|
int start; // start time in global paintsamples
|
||||||
int pos; // sample position in sfx, <0 means delay sound start (shifted up by 8)
|
int pos; // sample position in sfx, <0 means delay sound start (shifted up by 8)
|
||||||
int rate; // 24.8 fixed point rate scaling
|
int rate; // 24.8 fixed point rate scaling
|
||||||
|
int flags; // cf_ flags
|
||||||
int looping; // where to loop, -1 = no looping
|
int looping; // where to loop, -1 = no looping
|
||||||
int entnum; // to allow overriding a specific sound
|
int entnum; // to allow overriding a specific sound
|
||||||
int entchannel; //int audio_fd
|
int entchannel; //int audio_fd
|
||||||
|
@ -180,7 +181,7 @@ void S_SetUnderWater(qboolean underwater);
|
||||||
void S_Restart_f (void);
|
void S_Restart_f (void);
|
||||||
|
|
||||||
//plays streaming audio
|
//plays streaming audio
|
||||||
void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels, int width);
|
void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels, int width, float volume);
|
||||||
|
|
||||||
void CLVC_Poll (void);
|
void CLVC_Poll (void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue