Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
89 lines (69 loc) · 1.63 KB

File metadata and controls

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