Merge pull request #230 from fmwviormv/patch-1
reset samplefrac to 8-bits, to prevent overflow
This commit is contained in:
commit
d85a544bf2
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