comparison 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
comparison
equal deleted inserted replaced
1659:14717b52abc0 1660:8b9d79e7eacf
326 break; 326 break;
327 default: 327 default:
328 return 0; 328 return 0;
329 } 329 }
330 return format; 330 return format;
331 }
332
333 int SDL_GetNumAudioDrivers(void)
334 {
335 return(SDL_arraysize(bootstrap)-1);
336 }
337
338 const char *SDL_GetAudioDriver(int index)
339 {
340 if ( index >= 0 && index < SDL_GetNumAudioDrivers() ) {
341 return(bootstrap[index]->name);
342 }
343 return(NULL);
331 } 344 }
332 345
333 int SDL_AudioInit(const char *driver_name) 346 int SDL_AudioInit(const char *driver_name)
334 { 347 {
335 SDL_AudioDevice *audio; 348 SDL_AudioDevice *audio;
417 } 430 }
418 } 431 }
419 return(0); 432 return(0);
420 } 433 }
421 434
422 char *SDL_AudioDriverName(char *namebuf, int maxlen) 435 const char *SDL_GetCurrentAudioDriver()
423 { 436 {
424 if ( current_audio != NULL ) { 437 if ( current_audio ) {
425 SDL_strlcpy(namebuf, current_audio->name, maxlen); 438 return current_audio->name;
426 return(namebuf);
427 } 439 }
428 return(NULL); 440 return(NULL);
429 } 441 }
430 442
431 int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) 443 int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)