7#define _CRT_SECURE_NO_WARNINGS
35 remove(
"sdlaudio.raw");
87 const char* audioDriver;
96 SDLTest_AssertCheck(iMax > 0,
"Validate number of audio drivers; expected: >0 got: %d", iMax);
97 for (
i = 0;
i < iMax;
i++) {
101 SDLTest_AssertCheck(audioDriver[0] !=
'\0',
"Audio driver name is not empty; got: %s", audioDriver);
141 int result, expectedResult;
143 const char* audioDriver;
153 SDLTest_AssertCheck(iMax > 0,
"Validate number of audio drivers; expected: >0 got: %d", iMax);
154 for (
i = 0;
i < iMax;
i++) {
158 SDLTest_AssertCheck(audioDriver[0] !=
'\0',
"Audio driver name is not empty; got: %s", audioDriver);
161 for (
j = 0;
j < 2;
j++) {
173 desired.
freq = 22050;
182 desired.
freq = 48000;
192 for (
k=0;
k <=
j;
k++) {
195 expectedResult = (
k==0) ? 0 : -1;
200 for (
k=0;
k <=
j;
k++) {
206 for (
k=0;
k <=
j;
k++) {
228 int i, iMax,
j,
k, l;
232 const char* audioDriver;
242 SDLTest_AssertCheck(iMax > 0,
"Validate number of audio drivers; expected: >0 got: %d", iMax);
243 for (
i = 0;
i < iMax;
i++) {
247 SDLTest_AssertCheck(audioDriver[0] !=
'\0',
"Audio driver name is not empty; got: %s", audioDriver);
250 for (
j = 0;
j < 2;
j++) {
262 desired.
freq = 22050;
271 desired.
freq = 48000;
286 for (l=0; l<3; l++) {
295 for (
k=0;
k <=
j;
k++) {
311 for (
k=0;
k <=
j;
k++) {
350 const char *
name, *nameAgain;
353 for (
t=0;
t<2;
t++) {
358 SDLTest_Log(
"Number of %s devices < 0, reported as %i", (
t) ?
"capture" :
"output",
n);
365 SDLTest_AssertCheck(
n==nn,
"Verify result from SDL_GetNumAudioDevices(%i), expected same number of audio devices %i, got %i", tt,
n, nn);
367 SDLTest_AssertCheck(
n==nn,
"Verify result from SDL_GetNumAudioDevices(%i), expected same number of audio devices %i, got %i", -tt,
n, nn);
372 for (
i=0;
i<
n;
i++) {
383 if (nameAgain !=
NULL) {
384 SDLTest_AssertCheck(nameAgain[0] !=
'\0',
"Verify result from SDL_GetAudioDeviceName(%i, %i) is not empty, got: '%s'",
i, tt, nameAgain);
386 "Verify SDL_GetAudioDeviceName(%i, %i) and SDL_GetAudioDeviceName(%i %i) return the same string",
417 for (
t=0;
t<2;
t++) {
425 for (
j=0;
j<3;
j++) {
426 i = (
t) ? nc+
j : no+
j;
433 if ((no>0) && (no>nc) && (
t==1)) {
464 for (
i=0;
i<
n;
i++) {
501char *
_audioFormatsVerbose[] = {
"AUDIO_S8",
"AUDIO_U8",
"AUDIO_S16LSB",
"AUDIO_S16MSB",
"AUDIO_S16SYS",
"AUDIO_S16",
"AUDIO_U16LSB",
502 "AUDIO_U16MSB",
"AUDIO_U16SYS",
"AUDIO_U16",
"AUDIO_S32LSB",
"AUDIO_S32MSB",
"AUDIO_S32SYS",
"AUDIO_S32",
503 "AUDIO_F32LSB",
"AUDIO_F32MSB",
"AUDIO_F32SYS",
"AUDIO_F32" };
521 int i, ii,
j, jj,
k, kk;
559 SDLTest_AssertPass(
"Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
560 i,
_audioFormatsVerbose[
i], spec1.
format,
j, spec1.
channels,
k, spec1.
freq, ii,
_audioFormatsVerbose[ii], spec2.
format, jj, spec2.
channels, kk, spec2.
freq);
581 const char *expectedError =
"Parameter 'cvt' is invalid";
611 "Validate error message, expected: '%s', got: '%s'", expectedError, error);
615 for (
i = 1;
i < 64;
i++) {
682 "Verify returned value; expected: STOPPED (%i) | PLAYING (%i) | PAUSED (%i), got: %i",
733 "Verify returned value; expected: STOPPED (%i) | PLAYING (%i) | PAUSED (%i), got: %i",
792 SDLTest_Log(
"Simulate callback processing - delay");
825 int i, ii,
j, jj,
k, kk, l, ll;
828 for (
c = 1;
c < 8;
c++) {
865 }
while ((
i == ii) && (
j == jj) && (
k == kk));
872 SDLTest_AssertPass(
"Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
873 i,
_audioFormatsVerbose[
i], spec1.
format,
j, spec1.
channels,
k, spec1.
freq, ii,
_audioFormatsVerbose[ii], spec2.
format, jj, spec2.
channels, kk, spec2.
freq);
884 SDLTest_Log(
"Creating dummy sample buffer of %i length (%i bytes)", l, ll);
951#ifdef AUDIODEVICECONNECTED_DEFINED
953 result = SDL_AudioDeviceConnected(
id);
Uint16 SDL_AudioFormat
Audio format flags.
#define SDL_AUDIO_ALLOW_ANY_CHANGE
#define SDL_InitSubSystem
#define SDL_GetNumAudioDrivers
#define SDL_GetAudioDeviceName
#define SDL_BuildAudioCVT
#define SDL_GetCurrentAudioDriver
#define SDL_OpenAudioDevice
#define SDL_GetAudioStatus
#define SDL_GetAudioDeviceStatus
#define SDL_CloseAudioDevice
#define SDL_GetAudioDriver
#define SDL_GetNumAudioDevices
#define SDL_QuitSubSystem
#define SDL_UnlockAudioDevice
#define SDL_LockAudioDevice
GLuint GLuint GLsizei count
GLuint GLsizei const GLchar * message
GLuint const GLchar * name
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(1)
Explicitly pass without checking an assertion condition. Updates assertion counter.
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription,...) SDL_PRINTF_VARARG_FUNC(2)
Assert for test cases that logs but does not break execution flow on failures. Updates assertion coun...
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
int(* SDLTest_TestCaseFp)(void *arg)
void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and the ERROR priority.
void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
Prints given message with a timestamp in the TEST category and INFO priority.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym return Display _Xconst char Bool return Display _Xconst char return XKeyEvent char int KeySym XComposeStatus return Display int int int XVisualInfo return Display Window int int return _Xconst char return Display XEvent return Display Drawable GC XImage int int int int unsigned int unsigned int return Display Window Window Window int int int int unsigned int return Display Window Window int int return Display Window unsigned int unsigned int return Display Window Bool long XEvent return Display GC unsigned long return Display Window int Time return Display Window Window return Display Window unsigned long return Display Window XSizeHints Display Colormap XColor int return char int XTextProperty return XFontStruct _Xconst char int int int int XCharStruct return Display Window return Display Time return Display Colormap return Display Window Window int int unsigned int unsigned int int int return Display Window int return XExtensionInfo Display char XExtensionHooks int XPointer return XExtensionInfo XExtensionInfo Display return Display return Display unsigned long Display GC Display char long Display xReply int Bool return Display Bool return Display int SDL_X11_XESetEventToWireRetType return Display Window Window Window Window unsigned int return Display XShmSegmentInfo return Display Drawable GC XImage int int int int unsigned int unsigned int Boo k)
static SDL_AudioDeviceID device
A structure to hold a set of audio conversion filters and buffers.
SDL_AudioCallback callback
void _audioSetUp(void *arg)
static const SDLTest_TestCaseReference audioTest3
static const SDLTest_TestCaseReference audioTest13
int audio_initQuitAudio()
Start and stop audio directly.
int audio_convertAudio()
Convert audio using various conversion structures.
const int _numAudioFormats
int audio_enumerateAndNameAudioDevicesNegativeTests()
Negative tests around enumeration and naming of audio devices.
int audio_openCloseAndGetAudioStatus()
Opens, checks current audio status, and closes a device.
int audio_buildAudioCVTNegative()
Checkes calls with invalid input to SDL_BuildAudioCVT.
char * _audioFormatsVerbose[]
static const SDLTest_TestCaseReference audioTest7
SDL_AudioFormat _audioFormats[]
SDLTest_TestSuiteReference audioTestSuite
static const SDLTest_TestCaseReference audioTest15
int audio_printCurrentAudioDriver()
Checks current audio driver name with initialized audio.
static const SDLTest_TestCaseReference audioTest10
const int _numAudioFrequencies
int _audio_testCallbackLength
int audio_lockUnlockOpenAudioDevice()
Locks and unlocks open audio device.
static const SDLTest_TestCaseReference audioTest4
int audio_initOpenCloseQuitAudio()
Start, open, close and stop audio.
int audio_buildAudioCVT()
Builds various audio conversion structures.
int audio_quitInitAudioSubSystem()
Stop and restart audio subsystem.
static const SDLTest_TestCaseReference audioTest2
int audio_getAudioStatus()
Checks current audio status.
int audio_enumerateAndNameAudioDevices()
Enumerate and name available audio devices (output and capture).
static const SDLTest_TestCaseReference audioTest1
static const SDLTest_TestCaseReference audioTest11
static const SDLTest_TestCaseReference audioTest12
int audio_openCloseAudioDeviceConnected()
Opens, checks current connected status, and closes a device.
static const SDLTest_TestCaseReference audioTest14
static const SDLTest_TestCaseReference audioTest8
static const SDLTest_TestCaseReference * audioTests[]
int _audio_testCallbackCounter
int audio_printAudioDrivers()
Checks available audio driver names.
int audio_pauseUnpauseAudio()
Pause and unpause audio.
static const SDLTest_TestCaseReference audioTest6
const int _numAudioChannels
static const SDLTest_TestCaseReference audioTest9
static const SDLTest_TestCaseReference audioTest5
void _audioTearDown(void *arg)
void _audio_testCallback(void *userdata, Uint8 *stream, int len)