reset samplefrac to 8-bits, to prevent overflow
issue: https://github.com/ioquake/ioq3/issues/106
This commit is contained in:
parent
1246d16834
commit
2ef641b969
1 changed files with 6 additions and 2 deletions
|
@ -126,13 +126,15 @@ static int ResampleSfx( sfx_t *sfx, int channels, int inrate, int inwidth, int s
|
||||||
|
|
||||||
outcount = samples / stepscale;
|
outcount = samples / stepscale;
|
||||||
|
|
||||||
|
srcsample = 0;
|
||||||
samplefrac = 0;
|
samplefrac = 0;
|
||||||
fracstep = stepscale * 256 * channels;
|
fracstep = stepscale * 256 * channels;
|
||||||
chunk = sfx->soundData;
|
chunk = sfx->soundData;
|
||||||
|
|
||||||
for (i=0 ; i<outcount ; i++)
|
for (i=0 ; i<outcount ; i++)
|
||||||
{
|
{
|
||||||
srcsample = samplefrac >> 8;
|
srcsample += samplefrac >> 8;
|
||||||
|
samplefrac &= 255;
|
||||||
samplefrac += fracstep;
|
samplefrac += fracstep;
|
||||||
for (j=0 ; j<channels ; j++)
|
for (j=0 ; j<channels ; j++)
|
||||||
{
|
{
|
||||||
|
@ -178,12 +180,14 @@ static int ResampleSfxRaw( short *sfx, int channels, int inrate, int inwidth, in
|
||||||
|
|
||||||
outcount = samples / stepscale;
|
outcount = samples / stepscale;
|
||||||
|
|
||||||
|
srcsample = 0;
|
||||||
samplefrac = 0;
|
samplefrac = 0;
|
||||||
fracstep = stepscale * 256 * channels;
|
fracstep = stepscale * 256 * channels;
|
||||||
|
|
||||||
for (i=0 ; i<outcount ; i++)
|
for (i=0 ; i<outcount ; i++)
|
||||||
{
|
{
|
||||||
srcsample = samplefrac >> 8;
|
srcsample += samplefrac >> 8;
|
||||||
|
samplefrac &= 255;
|
||||||
samplefrac += fracstep;
|
samplefrac += fracstep;
|
||||||
for (j=0 ; j<channels ; j++)
|
for (j=0 ; j<channels ; j++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue