From 31651088f817d1c60b32269a6f5612450eeb3004 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Tue, 18 Jan 2011 13:31:00 -0700 Subject: [PATCH] some debugging checks in the mixer --- Quake/snd_mix.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Quake/snd_mix.c b/Quake/snd_mix.c index 4e2c718f..2eda8bb7 100644 --- a/Quake/snd_mix.c +++ b/Quake/snd_mix.c @@ -220,7 +220,7 @@ void S_PaintChannels (int endtime) if (sc->loopstart >= 0) { ch->pos = sc->loopstart; - ch->end = ltime + sc->length - ch->pos; + ch->end = ltime + (sc->length - ch->pos); } else { // channel just stopped @@ -297,10 +297,15 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count) leftvol = ch->leftvol * snd_vol; rightvol = ch->rightvol * snd_vol; - sfx = (signed short *)sc->data + ch->pos; - + sfx = (signed short *)sc->data + ch->pos; + for (i = 0; i < count; i++) { + if ((ch->pos + i) >= sc->length) + { + Con_Printf("Overran Sample!\n"); + } + data = sfx[i]; left = (data * leftvol) >> 8; right = (data * rightvol) >> 8;