comparison 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
comparison
equal deleted inserted replaced
1659:14717b52abc0 1660:8b9d79e7eacf
60 done = 1; 60 done = 1;
61 } 61 }
62 62
63 int main(int argc, char *argv[]) 63 int main(int argc, char *argv[])
64 { 64 {
65 char name[32]; 65 int i, n;
66
67 /* Print available audio drivers */
68 n = SDL_GetNumAudioDrivers();
69 if ( n == 0 ) {
70 printf("No built-in audio drivers\n");
71 } else {
72 printf("Built-in audio drivers:");
73 for ( i = 0; i < n; ++i ) {
74 if ( i > 0 ) {
75 printf(",");
76 }
77 printf(" %s", SDL_GetAudioDriver(i));
78 }
79 printf("\n");
80 }
66 81
67 /* Load the SDL library */ 82 /* Load the SDL library */
68 if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) { 83 if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
69 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); 84 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
70 return(1); 85 return(1);
100 quit(2); 115 quit(2);
101 } 116 }
102 SDL_PauseAudio(0); 117 SDL_PauseAudio(0);
103 118
104 /* Let the audio run */ 119 /* Let the audio run */
105 printf("Using audio driver: %s\n", SDL_AudioDriverName(name, 32)); 120 printf("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
106 while ( ! done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING) ) 121 while ( ! done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING) )
107 SDL_Delay(1000); 122 SDL_Delay(1000);
108 123
109 /* Clean up on signal */ 124 /* Clean up on signal */
110 SDL_CloseAudio(); 125 SDL_CloseAudio();