mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 22:11:22 +00:00
* snd_mix.c (SND_PaintChannelFrom16): multiplication might cause
integer overflow as observed in the warpspasm mod depending on the volume level. so, moved the left shifting to left/right volume before the multiplication. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@401 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
8354026d8e
commit
c3ec785b66
1 changed files with 8 additions and 2 deletions
|
@ -302,13 +302,19 @@ static void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count)
|
|||
|
||||
leftvol = ch->leftvol * snd_vol;
|
||||
rightvol = ch->rightvol * snd_vol;
|
||||
leftvol >>= 8;
|
||||
rightvol >>= 8;
|
||||
sfx = (signed short *)sc->data + ch->pos;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
data = sfx[i];
|
||||
left = (data * leftvol) >> 8;
|
||||
right = (data * rightvol) >> 8;
|
||||
// this was causing integer overflow as observed in quakespasm
|
||||
// with the warpspasm mod moved <<8 to left/right volume above.
|
||||
// left = (data * leftvol) >> 8;
|
||||
// right = (data * rightvol) >> 8;
|
||||
left = data * leftvol;
|
||||
right = data * rightvol;
|
||||
paintbuffer[i].left += left;
|
||||
paintbuffer[i].right += right;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue