/* ================== S_ClearSoundBuffer If we are about to perform file access, clear the buffer so sound doesn't stutter. ================== */ void S_ClearSoundBuffer( void ) { int clear; if (!s_soundStarted) return; // stop looping sounds Com_Memset(loopSounds, 0, MAX_GENTITIES*sizeof(loopSound_t)); Com_Memset(loop_channels, 0, MAX_CHANNELS*sizeof(channel_t)); numLoopChannels = 0; S_ChannelSetup(); s_rawend = 0; if (dma.samplebits == 8) clear = 0x80; else clear = 0; SNDDMA_BeginPainting (); if (dma.buffer) // TTimo: due to a particular bug workaround in linux sound code, // have to optionally use a custom C implementation of Com_Memset // not affecting win32, we have #define Snd_Memset Com_Memset // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371 Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8); SNDDMA_Submit (); }
/* ================== S_ClearBuffer ================== */ static void S_ClearBuffer (void) { int clear; if (!sound_started) return; #ifdef USE_OPENAL if (alSound) return; #endif s_rawend = 0; if (dma.samplebits == 8) clear = 0x80; else clear = 0; SNDDMA_BeginPainting (); if (dma.buffer) Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8); SNDDMA_Submit (); }
void S_DMAClearBuffer( void ) { int clear; if (!dmaInit) return; /* Clear the active channels and loops */ Com_Memset( dmaLoops, 0, sizeof( dmaLoops )); Com_Memset( dmaChannels, 0, sizeof( dmaChannels )); Com_Memset( &dmaEffect, 0, sizeof( &dmaEffect )); if (dma.samplebits == 8) clear = 0x80; else clear = 0; /* Fill the dma buffer */ SNDDMA_BeginPainting (); if (dma.buffer) Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8); SNDDMA_Submit (); }