[ioquake3] 03/25: reset samplefrac to 8-bits, to prevent overflow
Simon McVittie
smcv at debian.org
Sun Mar 12 18:23:24 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit 2ef641b969677193b62930df76e5795a176d9463
Author: fmwviormv <fmwviormv at users.noreply.github.com>
Date: Fri Oct 7 01:21:15 2016 +0330
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 655ae42..0ef3bd6 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<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++)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list