changeset 983:cb0e3b29a0dd

Several small changes (like driver selection).
author atmosfear
date Mon, 04 Jun 2001 00:27:55 +0000
parents 20e57b98de98
children e73777bc679f
files libao2/ao_sdl.c
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_sdl.c	Mon Jun 04 00:27:06 2001 +0000
+++ b/libao2/ao_sdl.c	Mon Jun 04 00:27:55 2001 +0000
@@ -35,6 +35,10 @@
 // ao_outburst
 // ao_buffersize
 
+extern int verbose;
+/* audio driver to be used by SDLlib */
+char *sdl_adriver;
+
 // Samplesize used by the SDLlib AudioSpec struct
 #define SAMPLESIZE 512
 
@@ -121,9 +125,15 @@
 	
 	int i;
 	/* Allocate ring-buffer memory */
-	for(i=0;i<NUM_BUFS;i++) buffer[i]=malloc(BUFFSIZE);
+	for(i=0;i<NUM_BUFS;i++) buffer[i]=(unsigned char *) malloc(BUFFSIZE);
 
 	printf("SDL: Samplerate: %iHz Channels: %s Format %iBit\n", rate, (channels > 1) ? "Stereo" : "Mono", format);
+
+	if(sdl_adriver) {
+		setenv("SDL_AUDIODRIVER", sdl_adriver, 1);
+		printf("SDL: using %s audio driver\n", sdl_adriver);
+	}	
+	
 	
 	/* The desired audio frequency in samples-per-second. */
 	aspec.freq     = rate;
@@ -156,7 +166,7 @@
         	return(0);
 	} 
 	
-	printf("SDL buf size = %d\n",aspec.size);
+	if(verbose) printf("SDL: buf size = %d\n",aspec.size);
 	if(ao_buffersize==-1) ao_buffersize=aspec.size;
 	
 	/* unsilence audio, if callback is ready */
@@ -167,6 +177,7 @@
 
 // close audio device
 static void uninit(){
+	if(verbose) printf("SDL: Audio Subsystem shutting down!\n");
 	SDL_CloseAudio();
 	SDL_QuitSubSystem(SDL_INIT_AUDIO);
 }
@@ -195,7 +206,7 @@
 // return: number of bytes played
 static int play(void* data,int len,int flags){
 
-#if 0	
+#if 1	
 	int ret;
 
 	/* Audio locking prohibits call of outputaudio */