--- np2/x11/snddrv/Attic/sdl.c 2003/11/16 16:43:45 1.1 +++ np2/x11/snddrv/Attic/sdl.c 2007/01/20 22:30:29 1.4 @@ -10,8 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -25,10 +23,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) - #include "compiler.h" +#if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) + #include "soundmng.h" #include "SDL.h" @@ -39,7 +37,7 @@ static void sdlaudio_callback(void *, un static BOOL sdlaudio_init(UINT rate, UINT samples) { - SDL_AudioSpec fmt; + static SDL_AudioSpec fmt; int rv; fmt.freq = rate; @@ -239,17 +237,17 @@ static void sdlaudio_callback(void *userdata, unsigned char *stream, int len) { UINT samples = (UINT)userdata; + int nextbuf = sound_nextbuf; UNUSED(len); if (sound_event != NULL) memset(sound_event, 0, samples); - - SDL_MixAudio(stream, sound_buffer[sound_nextbuf], samples, - SDL_MIX_MAXVOLUME); - sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; sound_event = sound_buffer[sound_nextbuf]; + + SDL_MixAudio(stream, sound_buffer[nextbuf], samples, + SDL_MIX_MAXVOLUME); } #endif /* USE_SDLAUDIO || USE_SDLMIXER */