Mercurial > sdl-ios-xcode
comparison test/loopwave.c @ 3359:aecbdf3362c3
Added some debug output to loopwave.c
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sat, 10 Oct 2009 06:32:11 +0000 |
parents | 8b76cc268771 |
children | dc6384958091 |
comparison
equal
deleted
inserted
replaced
3358:1164528004ff | 3359:aecbdf3362c3 |
---|---|
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 | |
67 int | 70 int |
68 main(int argc, char *argv[]) | 71 main(int argc, char *argv[]) |
69 { | 72 { |
73 char name[NAMESIZE]; | |
74 | |
70 /* Load the SDL library */ | 75 /* Load the SDL library */ |
71 if (SDL_Init(SDL_INIT_AUDIO) < 0) { | 76 if (SDL_Init(SDL_INIT_AUDIO) < 0) { |
72 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); | 77 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); |
73 return (1); | 78 return (1); |
74 } | 79 } |
99 if (SDL_OpenAudio(&wave.spec, NULL) < 0) { | 104 if (SDL_OpenAudio(&wave.spec, NULL) < 0) { |
100 fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); | 105 fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); |
101 SDL_FreeWAV(wave.sound); | 106 SDL_FreeWAV(wave.sound); |
102 quit(2); | 107 quit(2); |
103 } | 108 } |
104 SDL_PauseAudio(0); | 109 |
110 /* 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 | |
112 SDL_GetAudioDeviceName(), below. */ | |
113 printf("Using audio driver: %s\n", SDL_AudioDriverName(name, NAMESIZE)); | |
114 printf("Using audio device: %s\n", SDL_GetAudioDeviceName(1, 0)); | |
105 | 115 |
106 /* Let the audio run */ | 116 /* Let the audio run */ |
117 SDL_PauseAudio(0); | |
107 while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) | 118 while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) |
108 SDL_Delay(1000); | 119 SDL_Delay(1000); |
109 | 120 |
110 /* Clean up on signal */ | 121 /* Clean up on signal */ |
111 SDL_CloseAudio(); | 122 SDL_CloseAudio(); |