From ff1ffe2212268ee7a8267ee8f020404a0b7a2978 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 14 Oct 2000 00:03:05 +0000 Subject: [PATCH] just some ws. still haven't figure out what's causing the static. --- source/snd_mix.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/snd_mix.c b/source/snd_mix.c index 303ad83..d5ef70d 100644 --- a/source/snd_mix.c +++ b/source/snd_mix.c @@ -273,11 +273,11 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime); void S_PaintChannels(int endtime) { - int i; - int end; - channel_t *ch; + int i; + int end; + channel_t *ch; sfxcache_t *sc; - int ltime, count; + int ltime, count; while (paintedtime < endtime) { @@ -343,8 +343,12 @@ void S_PaintChannels(int endtime) // transfer out according to DMA format S_TransferPaintBuffer(end); - memcpy (paintbuffer, paintbuffer + end - paintedtime, max_overpaint * sizeof (paintbuffer[0])); - memset (paintbuffer + max_overpaint, 0, sizeof (paintbuffer) - max_overpaint * sizeof (paintbuffer[0])); + memcpy (paintbuffer, + paintbuffer + end - paintedtime, + max_overpaint * sizeof (paintbuffer[0])); + memset (paintbuffer + max_overpaint, + 0, + sizeof (paintbuffer) - max_overpaint * sizeof (paintbuffer[0])); paintedtime = end; } @@ -427,16 +431,20 @@ void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count) old_phase_left = 0; old_phase_right = -ch->oldphase; } + new_phase_left = left_phase; new_phase_right = right_phase; + if (new_phase_left > old_phase_left) count_left = 2 * (new_phase_left - old_phase_left); else count_left = old_phase_left - new_phase_left; + if (new_phase_right > old_phase_right) count_right = 2 * (new_phase_right - old_phase_right); else count_right = old_phase_right - new_phase_right; + c = min (count, max (count_right, count_left)); count -= c; while (c) {