diff test/loopwave.c @ 1660:8b9d79e7eacf SDL-1.3

Added API requested in bug #43: Added SDL_GetNumVideoDrivers() and SDL_GetVideoDriver(). Replaced SDL_VideoDriverName() with SDL_GetCurrentVideoDriver() Added SDL_GetNumAudioDrivers() and SDL_GetAudioDriver(). Replaced SDL_AudioDriverName() with SDL_GetCurrentAudioDriver()
author Sam Lantinga <slouken@libsdl.org>
date Sat, 20 May 2006 04:35:58 +0000
parents 14717b52abc0
children 782fd950bd46
line wrap: on
line diff
--- a/test/loopwave.c	Wed May 17 08:18:28 2006 +0000
+++ b/test/loopwave.c	Sat May 20 04:35:58 2006 +0000
@@ -62,7 +62,22 @@
 
 int main(int argc, char *argv[])
 {
-	char name[32];
+	int i, n;
+
+	/* Print available audio drivers */
+	n = SDL_GetNumAudioDrivers();
+	if ( n == 0 ) {
+		printf("No built-in audio drivers\n");
+	} else {
+		printf("Built-in audio drivers:");
+		for ( i = 0; i < n; ++i ) {
+			if ( i > 0 ) {
+				printf(",");
+			}
+			printf(" %s", SDL_GetAudioDriver(i));
+		}
+		printf("\n");
+	}
 
 	/* Load the SDL library */
 	if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
@@ -102,7 +117,7 @@
 	SDL_PauseAudio(0);
 
 	/* Let the audio run */
-	printf("Using audio driver: %s\n", SDL_AudioDriverName(name, 32));
+	printf("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
 	while ( ! done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING) )
 		SDL_Delay(1000);