diff src/audio/SDL_audio.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/src/audio/SDL_audio.c	Wed May 17 08:18:28 2006 +0000
+++ b/src/audio/SDL_audio.c	Sat May 20 04:35:58 2006 +0000
@@ -330,6 +330,19 @@
 	return format;
 }
 
+int SDL_GetNumAudioDrivers(void)
+{
+	return(SDL_arraysize(bootstrap)-1);
+}
+
+const char *SDL_GetAudioDriver(int index)
+{
+	if ( index >= 0 && index < SDL_GetNumAudioDrivers() ) {
+		return(bootstrap[index]->name);
+	}
+	return(NULL);
+}
+
 int SDL_AudioInit(const char *driver_name)
 {
 	SDL_AudioDevice *audio;
@@ -419,11 +432,10 @@
 	return(0);
 }
 
-char *SDL_AudioDriverName(char *namebuf, int maxlen)
+const char *SDL_GetCurrentAudioDriver()
 {
-	if ( current_audio != NULL ) {
-		SDL_strlcpy(namebuf, current_audio->name, maxlen);
-		return(namebuf);
+	if ( current_audio ) {
+		return current_audio->name;
 	}
 	return(NULL);
 }