Mercurial > sdl-ios-xcode
annotate test/testaudioinfo.c @ 3807:da371472162f SDL-ryan-multiple-audio-device
DART allegedly does up to quad output.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 04 Oct 2006 22:51:30 +0000 |
parents | 589bc3d060cd |
children | 7dc7327cd626 |
rev | line source |
---|---|
3789 | 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 | |
3795
589bc3d060cd
More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents:
3792
diff
changeset
|
8 printf("%s devices:\n", typestr); |
589bc3d060cd
More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents:
3792
diff
changeset
|
9 |
589bc3d060cd
More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents:
3792
diff
changeset
|
10 if (n == -1) |
589bc3d060cd
More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents:
3792
diff
changeset
|
11 printf(" Driver can't detect specific devices.\n\n", typestr); |
589bc3d060cd
More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents:
3792
diff
changeset
|
12 else if (n == 0) |
589bc3d060cd
More 1.3 audio work...moved dsp and dma drivers over to new model. Untested!
Ryan C. Gordon <icculus@icculus.org>
parents:
3792
diff
changeset
|
13 printf(" No %s devices found.\n\n", typestr); |
3789 | 14 else |
15 { | |
16 int i; | |
17 for (i = 0; i < n; i++) { | |
3792
866c310e2cb5
Changed some 1.3 audio symbol names.
Ryan C. Gordon <icculus@icculus.org>
parents:
3789
diff
changeset
|
18 printf(" %s\n", SDL_GetAudioDeviceName(i, iscapture)); |
3789 | 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 printf("Built-in audio drivers:\n"); | |
32 int i; | |
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 |