]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_sdl.c
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[xonotic/darkplaces.git] / snd_sdl.c
index de0f3dc9a2cc222d1ecf8289f8dadf92f841440b..839640945799aa58d3f85461f3b4b028a613519b 100644 (file)
--- a/snd_sdl.c
+++ b/snd_sdl.c
@@ -39,7 +39,6 @@ typedef struct AudioState_s
 } AudioState;
 
 
-extern mempool_t *snd_mempool;
 static AudioState       as;
 
 static void Buffer_Callback(void *userdata, Uint8 *stream, int len);
@@ -93,7 +92,7 @@ qboolean SNDDMA_Init(void)
 
        // Init the shm structure
        memset( (void*) shm, 0, sizeof(*shm) );
-       
+
        shm->format.channels = 2; //stereo
        shm->format.width = 2;
 
@@ -107,7 +106,7 @@ qboolean SNDDMA_Init(void)
        shm->samplepos = 0;
        shm->samples = AUDIO_SDL_SAMPLES * AUDIO_LOCALFACTOR;
        shm->bufferlength = shm->samples * shm->format.width;
-       shm->buffer = Mem_Alloc( snd_mempool, shm->bufferlength );
+       shm->buffer = (qbyte *)Mem_Alloc( snd_mempool, shm->bufferlength );
 
        // Init the as structure
        as.buffer = shm->buffer;
@@ -118,21 +117,21 @@ qboolean SNDDMA_Init(void)
        // Init the SDL Audio subsystem
        spec.callback = Buffer_Callback;
        spec.channels = shm->format.channels;
-       spec.format = AUDIO_S16LSB;
+       spec.format = AUDIO_S16SYS;
        spec.freq = shm->format.speed;
        spec.userdata = NULL;
-       spec.samples = AUDIO_SDL_SAMPLES; 
-       
+       spec.samples = AUDIO_SDL_SAMPLES;
+
        if( SDL_OpenAudio( &spec, NULL ) ) {
                Con_Print( "Failed to open the audio device!\n" );
-               Con_DPrintf( 
+               Con_DPrintf(
                        "Audio Specification:\n"
                        "\tChannels  : %i\n"
                        "\tFormat    : %x\n"
                        "\tFrequency : %i\n"
-                       "\tBuffersize: %i Bytes(%i Samples)\n", 
+                       "\tBuffersize: %i Bytes(%i Samples)\n",
                        spec.channels, spec.format, spec.freq, shm->bufferlength , spec.samples );
-               Mem_Free( shm->buffer ); 
+               Mem_Free( shm->buffer );
                return false;
        }