Mercurial > sdl-ios-xcode
comparison test/automated/audio/audio.c @ 3259:22ac66da0765
Merged Edgar's code changes from Google Summer of Code 2009
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 07 Sep 2009 05:06:34 +0000 |
parents | |
children | c32c53fca10d |
comparison
equal
deleted
inserted
replaced
3258:e786366ea23b | 3259:22ac66da0765 |
---|---|
1 /** | |
2 * Automated SDL_RWops test. | |
3 * | |
4 * Written by Edgar Simo "bobbens" | |
5 * | |
6 * Released under Public Domain. | |
7 */ | |
8 | |
9 | |
10 #include "SDL.h" | |
11 #include "SDL_at.h" | |
12 | |
13 | |
14 /** | |
15 * @brief Prints available devices. | |
16 */ | |
17 static int audio_printDevices( int iscapture ) | |
18 { | |
19 int i, n; | |
20 | |
21 /* Get number of devices. */ | |
22 n = SDL_GetNumAudioDevices(iscapture); | |
23 SDL_ATprintVerbose( 1, "%d %s Audio Devices\n", | |
24 n, iscapture ? "Capture" : "Output" ); | |
25 | |
26 /* List devices. */ | |
27 for (i=0; i<n; i++) { | |
28 SDL_ATprintVerbose( 1, " %d) %s\n", i+1, SDL_GetAudioDeviceName( i, iscapture ) ); | |
29 } | |
30 | |
31 return 0; | |
32 } | |
33 | |
34 | |
35 /** | |
36 * @brief Makes sure parameters work properly. | |
37 */ | |
38 static void audio_testOpen (void) | |
39 { | |
40 int i, n; | |
41 int ret; | |
42 | |
43 /* Begin testcase. */ | |
44 SDL_ATbegin( "Audio Open" ); | |
45 | |
46 /* List drivers. */ | |
47 n = SDL_GetNumAudioDrivers(); | |
48 SDL_ATprintVerbose( 1, "%d Audio Drivers\n", n ); | |
49 for (i=0; i<n; i++) { | |
50 SDL_ATprintVerbose( 1, " %s\n", SDL_GetAudioDriver(i) ); | |
51 } | |
52 | |
53 /* Start SDL. */ | |
54 ret = SDL_Init( SDL_INIT_AUDIO ); | |
55 if (SDL_ATvassert( ret==0, "SDL_Init( SDL_INIT_AUDIO ): %s", SDL_GetError())) | |
56 return; | |
57 | |
58 /* Print devices. */ | |
59 SDL_ATprintVerbose( 1, "Using Audio Driver '%s'\n", SDL_GetCurrentAudioDriver() ); | |
60 audio_printDevices(0); | |
61 audio_printDevices(1); | |
62 | |
63 /* Quit SDL. */ | |
64 SDL_Quit(); | |
65 | |
66 /* End testcase. */ | |
67 SDL_ATend(); | |
68 } | |
69 | |
70 | |
71 /** | |
72 * @brief Entry point. | |
73 */ | |
74 #ifdef TEST_STANDALONE | |
75 int main( int argc, const char *argv[] ) | |
76 { | |
77 (void) argc; | |
78 (void) argv; | |
79 #else /* TEST_STANDALONE */ | |
80 int test_audio (void) | |
81 { | |
82 #endif /* TEST_STANDALONE */ | |
83 | |
84 SDL_ATinit( "SDL_Audio" ); | |
85 | |
86 audio_testOpen(); | |
87 | |
88 return SDL_ATfinish(); | |
89 } |