mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 22:01:50 +00:00
Fix overflow in sound mixing.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5612 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a3d6a3fdec
commit
08547509e3
1 changed files with 2 additions and 2 deletions
|
@ -550,12 +550,12 @@ static void SND_PaintChannel16_O2I1 (channel_t *ch, sfxcache_t *sc, int starttim
|
||||||
|
|
||||||
if (rate != (1<<PITCHSHIFT))
|
if (rate != (1<<PITCHSHIFT))
|
||||||
{
|
{
|
||||||
signed short data;
|
signed int data;
|
||||||
sfx = (signed short *)sc->data;
|
sfx = (signed short *)sc->data;
|
||||||
for (i=0 ; i<count ; i++)
|
for (i=0 ; i<count ; i++)
|
||||||
{
|
{
|
||||||
int frac = pos&((1<<PITCHSHIFT)-1);
|
int frac = pos&((1<<PITCHSHIFT)-1);
|
||||||
data = sfx[pos>>PITCHSHIFT] * ((1<<PITCHSHIFT)-1-frac) + sfx[(pos>>PITCHSHIFT)+1] * frac;
|
data = sfx[pos>>PITCHSHIFT] * ((1<<PITCHSHIFT)-frac) + sfx[(pos>>PITCHSHIFT)+1] * frac;
|
||||||
pos += rate;
|
pos += rate;
|
||||||
paintbuffer[starttime+i].s[0] += (leftvol * data)>>(PITCHSHIFT+8);
|
paintbuffer[starttime+i].s[0] += (leftvol * data)>>(PITCHSHIFT+8);
|
||||||
paintbuffer[starttime+i].s[1] += (rightvol * data)>>(PITCHSHIFT+8);
|
paintbuffer[starttime+i].s[1] += (rightvol * data)>>(PITCHSHIFT+8);
|
||||||
|
|
Loading…
Reference in a new issue