/[pcsx2_0.9.7]/trunk/3rdparty/SDL-1.3.0-5387/test/testaudioinfo.c
ViewVC logotype

Contents of /trunk/3rdparty/SDL-1.3.0-5387/test/testaudioinfo.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 401 - (show annotations) (download)
Fri Feb 25 17:31:09 2011 UTC (9 years, 9 months ago) by william
File MIME type: text/plain
File size: 1264 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4358 local: v0.9.7.313-latest) in ./trunk
1 #include <stdio.h>
2 #include "SDL.h"
3
4 static void
5 print_devices(int iscapture)
6 {
7 const char *typestr = ((iscapture) ? "capture" : "output");
8 int n = SDL_GetNumAudioDevices(iscapture);
9
10 printf("%s devices:\n", typestr);
11
12 if (n == -1)
13 printf(" Driver can't detect specific devices.\n\n", typestr);
14 else if (n == 0)
15 printf(" No %s devices found.\n\n", typestr);
16 else {
17 int i;
18 for (i = 0; i < n; i++) {
19 printf(" %s\n", SDL_GetAudioDeviceName(i, iscapture));
20 }
21 printf("\n");
22 }
23 }
24
25 int
26 main(int argc, char **argv)
27 {
28 /* Load the SDL library */
29 if (SDL_Init(SDL_INIT_AUDIO) < 0) {
30 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
31 return (1);
32 }
33
34 /* Print available audio drivers */
35 int n = SDL_GetNumAudioDrivers();
36 if (n == 0) {
37 printf("No built-in audio drivers\n\n");
38 } else {
39 int i;
40 printf("Built-in audio drivers:\n");
41 for (i = 0; i < n; ++i) {
42 printf(" %s\n", SDL_GetAudioDriver(i));
43 }
44 printf("\n");
45 }
46
47 printf("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());
48
49 print_devices(0);
50 print_devices(1);
51
52 SDL_Quit();
53 return 0;
54 }

  ViewVC Help
Powered by ViewVC 1.1.22