fix last commit

This commit is contained in:
Eric Wasylishen 2011-01-19 14:02:28 -07:00
parent 4ad3c2d0ee
commit 30825d4d0a
2 changed files with 9 additions and 13 deletions

View file

@ -598,8 +598,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation)
*/ */
void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_channels, const byte *data, float volume ) { void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_channels, const byte *data, float volume ) {
int i; int i;
int src, dst; int dst;
float scale;
int intVolume; int intVolume;
portable_samplepair_t *rawsamples; portable_samplepair_t *rawsamples;
void *resampler; void *resampler;
@ -642,8 +641,8 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan
{ {
dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1);
s_rawend[stream]++; s_rawend[stream]++;
rawsamples[dst].left = ((short *)data)[i*2] * intVolume; rawsamples[dst].left = ((short *)resampled)[i*2] * intVolume;
rawsamples[dst].right = ((short *)data)[i*2+1] * intVolume; rawsamples[dst].right = ((short *)resampled)[i*2+1] * intVolume;
} }
} }
else if (s_channels == 1) else if (s_channels == 1)
@ -652,8 +651,8 @@ void S_Base_RawSamples( int stream, int samples, int rate, int width, int s_chan
{ {
dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1); dst = s_rawend[stream]&(MAX_RAW_SAMPLES-1);
s_rawend[stream]++; s_rawend[stream]++;
rawsamples[dst].left = ((short *)data)[i] * intVolume; rawsamples[dst].left = ((short *)resampled)[i] * intVolume;
rawsamples[dst].right = ((short *)data)[i] * intVolume; rawsamples[dst].right = ((short *)resampled)[i] * intVolume;
} }
} }
else else

View file

@ -259,7 +259,6 @@ void SND_InitScaletable (void)
void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count) void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
{ {
int data; int data;
int *lscale, *rscale;
unsigned char *sfx; unsigned char *sfx;
int i; int i;
@ -268,15 +267,13 @@ void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count)
if (ch->rightvol > 255) if (ch->rightvol > 255)
ch->rightvol = 255; ch->rightvol = 255;
lscale = snd_scaletable[ch->leftvol >> 3]; sfx = (unsigned char *) ((unsigned char *)sc->data + ch->pos);
rscale = snd_scaletable[ch->rightvol >> 3];
sfx = (unsigned char *) ((signed char *)sc->data + ch->pos);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
data = sfx[i]; data = (sfx[i] - 128) * snd_vol;
paintbuffer[i].left += lscale[data] * snd_vol; paintbuffer[i].left += data * ch->leftvol;
paintbuffer[i].right += rscale[data] * snd_vol; paintbuffer[i].right += data * ch->rightvol;
} }
ch->pos += count; ch->pos += count;