mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-02-21 03:21:45 +00:00
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;
|
||||
|
||||
srcsample = 0;
|
||||
samplefrac = 0;
|
||||
fracstep = stepscale * 256 * channels;
|
||||
chunk = sfx->soundData;
|
||||
|
||||
for (i=0 ; i<outcount ; i++)
|
||||
{
|
||||
srcsample = samplefrac >> 8;
|
||||
srcsample += samplefrac >> 8;
|
||||
samplefrac &= 255;
|
||||
samplefrac += fracstep;
|
||||
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;
|
||||
|
||||
srcsample = 0;
|
||||
samplefrac = 0;
|
||||
fracstep = stepscale * 256 * channels;
|
||||
|
||||
for (i=0 ; i<outcount ; i++)
|
||||
{
|
||||
srcsample = samplefrac >> 8;
|
||||
srcsample += samplefrac >> 8;
|
||||
samplefrac &= 255;
|
||||
samplefrac += fracstep;
|
||||
for (j=0 ; j<channels ; j++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue