From 2ef641b969677193b62930df76e5795a176d9463 Mon Sep 17 00:00:00 2001 From: fmwviormv Date: Fri, 7 Oct 2016 01:21:15 +0330 Subject: [PATCH] reset samplefrac to 8-bits, to prevent overflow issue: https://github.com/ioquake/ioq3/issues/106 --- code/client/snd_mem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/client/snd_mem.c b/code/client/snd_mem.c index 655ae420..0ef3bd6b 100644 --- a/code/client/snd_mem.c +++ b/code/client/snd_mem.c @@ -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> 8; + srcsample += samplefrac >> 8; + samplefrac &= 255; samplefrac += fracstep; for (j=0 ; j> 8; + srcsample += samplefrac >> 8; + samplefrac &= 255; samplefrac += fracstep; for (j=0 ; j