|
|
| version 1.1, 2003/11/16 16:43:45 | version 1.4, 2007/01/20 22:30:29 |
|---|---|
| Line 10 | Line 10 |
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. | * 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 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| Line 25 | Line 23 |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ | */ |
| #if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) | |
| #include "compiler.h" | #include "compiler.h" |
| #if defined(USE_SDLAUDIO) || defined(USE_SDLMIXER) | |
| #include "soundmng.h" | #include "soundmng.h" |
| #include "SDL.h" | #include "SDL.h" |
| Line 39 static void sdlaudio_callback(void *, un | Line 37 static void sdlaudio_callback(void *, un |
| static BOOL | static BOOL |
| sdlaudio_init(UINT rate, UINT samples) | sdlaudio_init(UINT rate, UINT samples) |
| { | { |
| SDL_AudioSpec fmt; | static SDL_AudioSpec fmt; |
| int rv; | int rv; |
| fmt.freq = rate; | fmt.freq = rate; |
| Line 239 static void | Line 237 static void |
| sdlaudio_callback(void *userdata, unsigned char *stream, int len) | sdlaudio_callback(void *userdata, unsigned char *stream, int len) |
| { | { |
| UINT samples = (UINT)userdata; | UINT samples = (UINT)userdata; |
| int nextbuf = sound_nextbuf; | |
| UNUSED(len); | UNUSED(len); |
| if (sound_event != NULL) | if (sound_event != NULL) |
| memset(sound_event, 0, samples); | memset(sound_event, 0, samples); |
| SDL_MixAudio(stream, sound_buffer[sound_nextbuf], samples, | |
| SDL_MIX_MAXVOLUME); | |
| sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; | sound_nextbuf = (sound_nextbuf + 1) % NSOUNDBUFFER; |
| sound_event = sound_buffer[sound_nextbuf]; | sound_event = sound_buffer[sound_nextbuf]; |
| SDL_MixAudio(stream, sound_buffer[nextbuf], samples, | |
| SDL_MIX_MAXVOLUME); | |
| } | } |
| #endif /* USE_SDLAUDIO || USE_SDLMIXER */ | #endif /* USE_SDLAUDIO || USE_SDLMIXER */ |