#include #include "SDL.h" #include "SDL_audio.h" #define NUM_SOUNDS 1 struct sample { Uint8 *data; Uint32 dpos; Uint32 dlen; } sounds[NUM_SOUNDS]; void mixaudio(void *unused, Uint8 *stream, int len) { int i; Uint32 amount; for ( i=0; i len ) { amount = len; } SDL_MixAudio(stream, &sounds[i].data[sounds[i].dpos], amount, SDL_MIX_MAXVOLUME); sounds[i].dpos += amount; } } void PlaySound(char *file) { int index; SDL_AudioSpec wave; Uint8 *data; Uint32 dlen; SDL_AudioCVT cvt; /* Look for an empty (or finished) sound slot */ for ( index=0; index