Mercurial > sdl-ios-xcode
comparison test/testaudioinfo.c @ 2049:5f6550e5184f
Merged SDL-ryan-multiple-audio-device branch r2803:2871 into the trunk.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 17 Oct 2006 09:15:21 +0000 |
parents | |
children | 866052b01ee5 |
comparison
equal
deleted
inserted
replaced
2048:6067c7f9a672 | 2049:5f6550e5184f |
---|---|
1 #include "SDL.h" | |
2 | |
3 static void print_devices(int iscapture) | |
4 { | |
5 const char *typestr = ((iscapture) ? "capture" : "output"); | |
6 int n = SDL_GetNumAudioDevices(iscapture); | |
7 | |
8 printf("%s devices:\n", typestr); | |
9 | |
10 if (n == -1) | |
11 printf(" Driver can't detect specific devices.\n\n", typestr); | |
12 else if (n == 0) | |
13 printf(" No %s devices found.\n\n", typestr); | |
14 else | |
15 { | |
16 int i; | |
17 for (i = 0; i < n; i++) { | |
18 printf(" %s\n", SDL_GetAudioDeviceName(i, iscapture)); | |
19 } | |
20 printf("\n"); | |
21 } | |
22 } | |
23 | |
24 int main(int argc, char **argv) | |
25 { | |
26 /* Print available audio drivers */ | |
27 int n = SDL_GetNumAudioDrivers(); | |
28 if (n == 0) { | |
29 printf("No built-in audio drivers\n\n"); | |
30 } else { | |
31 int i; | |
32 printf("Built-in audio drivers:\n"); | |
33 for (i = 0; i < n; ++i) { | |
34 printf(" %s\n", SDL_GetAudioDriver(i)); | |
35 } | |
36 printf("\n"); | |
37 } | |
38 | |
39 /* Load the SDL library */ | |
40 if (SDL_Init(SDL_INIT_AUDIO) < 0) { | |
41 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); | |
42 return (1); | |
43 } | |
44 | |
45 printf("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver()); | |
46 | |
47 print_devices(0); | |
48 print_devices(1); | |
49 | |
50 SDL_Quit(); | |
51 return 0; | |
52 } | |
53 |