From 86fdb54929347624ab874b47a9f9145cf363bbd2 Mon Sep 17 00:00:00 2001 From: Jamie Wilkinson Date: Sun, 1 Dec 2002 04:17:16 +0000 Subject: [PATCH] - Disabled using memset on sound buffer since it may be read-only. In future, one may want to test for this case and use memset if the buffer is writeable. (icculus patchset #11) --- src/snd_dma.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/snd_dma.c b/src/snd_dma.c index 082ae31..1a79c2e 100644 --- a/src/snd_dma.c +++ b/src/snd_dma.c @@ -774,8 +774,18 @@ void S_ClearBuffer (void) clear = 0; SNDDMA_BeginPainting (); - if (dma.buffer) - memset(dma.buffer, clear, dma.samples * dma.samplebits/8); + if (dma.buffer) { + /* buffer may be read-only, clear manually */ + /* memset(dma.buffer, clear, dma.samples * dma.samplebits/8); */ + int i; + unsigned char * ptr = (unsigned char *) dma.buffer; + + i = dma.samples * dma.samplebits/8; + while (i--) { + *ptr = clear; + ptr++; + } + } SNDDMA_Submit (); }