comparison test/loopwave.c @ 3360:dc6384958091

Use new 1.3 API for getting audio driver name.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 10 Oct 2009 06:39:59 +0000
parents aecbdf3362c3
children 6e70cf55a368
comparison
equal deleted inserted replaced
3359:aecbdf3362c3 3360:dc6384958091
62 poked(int sig) 62 poked(int sig)
63 { 63 {
64 done = 1; 64 done = 1;
65 } 65 }
66 66
67
68 #define NAMESIZE 32
69
70 int 67 int
71 main(int argc, char *argv[]) 68 main(int argc, char *argv[])
72 { 69 {
73 char name[NAMESIZE];
74
75 /* Load the SDL library */ 70 /* Load the SDL library */
76 if (SDL_Init(SDL_INIT_AUDIO) < 0) { 71 if (SDL_Init(SDL_INIT_AUDIO) < 0) {
77 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); 72 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
78 return (1); 73 return (1);
79 } 74 }
108 } 103 }
109 104
110 /* Right now we're using the 1.2 SDL_OpenAudio(), but if we move to the 105 /* Right now we're using the 1.2 SDL_OpenAudio(), but if we move to the
111 1.3 device enumeration version, we shouldn't hardcore device id #1 for 106 1.3 device enumeration version, we shouldn't hardcore device id #1 for
112 SDL_GetAudioDeviceName(), below. */ 107 SDL_GetAudioDeviceName(), below. */
113 printf("Using audio driver: %s\n", SDL_AudioDriverName(name, NAMESIZE)); 108 printf("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
114 printf("Using audio device: %s\n", SDL_GetAudioDeviceName(1, 0)); 109 printf("Using audio device: %s\n", SDL_GetAudioDeviceName(1, 0));
115 110
116 /* Let the audio run */ 111 /* Let the audio run */
117 SDL_PauseAudio(0); 112 SDL_PauseAudio(0);
118 while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) 113 while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING))