forked from Green-Sky/tomato
Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
58
external/sdl/SDL/test/testautomation_audio.c
vendored
58
external/sdl/SDL/test/testautomation_audio.c
vendored
@ -59,7 +59,7 @@ static SDL_AudioDeviceID g_audio_id = -1;
|
||||
/* Test case functions */
|
||||
|
||||
/**
|
||||
* \brief Stop and restart audio subsystem
|
||||
* Stop and restart audio subsystem
|
||||
*
|
||||
* \sa SDL_QuitSubSystem
|
||||
* \sa SDL_InitSubSystem
|
||||
@ -77,7 +77,7 @@ static int audio_quitInitAudioSubSystem(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Start and stop audio directly
|
||||
* Start and stop audio directly
|
||||
*
|
||||
* \sa SDL_InitAudio
|
||||
* \sa SDL_QuitAudio
|
||||
@ -87,6 +87,7 @@ static int audio_initQuitAudio(void *arg)
|
||||
int result;
|
||||
int i, iMax;
|
||||
const char *audioDriver;
|
||||
const char *hint = SDL_GetHint(SDL_HINT_AUDIO_DRIVER);
|
||||
|
||||
/* Stop SDL audio subsystem */
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
@ -102,6 +103,10 @@ static int audio_initQuitAudio(void *arg)
|
||||
SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL");
|
||||
SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */
|
||||
|
||||
if (hint && SDL_strcmp(audioDriver, hint) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Call Init */
|
||||
SDL_SetHint("SDL_AUDIO_DRIVER", audioDriver);
|
||||
result = SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
@ -133,7 +138,7 @@ static int audio_initQuitAudio(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Start, open, close and stop audio
|
||||
* Start, open, close and stop audio
|
||||
*
|
||||
* \sa SDL_InitAudio
|
||||
* \sa SDL_OpenAudioDevice
|
||||
@ -146,6 +151,7 @@ static int audio_initOpenCloseQuitAudio(void *arg)
|
||||
int i, iMax, j, k;
|
||||
const char *audioDriver;
|
||||
SDL_AudioSpec desired;
|
||||
const char *hint = SDL_GetHint(SDL_HINT_AUDIO_DRIVER);
|
||||
|
||||
/* Stop SDL audio subsystem */
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
@ -161,6 +167,10 @@ static int audio_initOpenCloseQuitAudio(void *arg)
|
||||
SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL");
|
||||
SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */
|
||||
|
||||
if (hint && SDL_strcmp(audioDriver, hint) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Change specs */
|
||||
for (j = 0; j < 2; j++) {
|
||||
|
||||
@ -219,7 +229,7 @@ static int audio_initOpenCloseQuitAudio(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Pause and unpause audio
|
||||
* Pause and unpause audio
|
||||
*
|
||||
* \sa SDL_PauseAudioDevice
|
||||
* \sa SDL_PlayAudioDevice
|
||||
@ -231,6 +241,7 @@ static int audio_pauseUnpauseAudio(void *arg)
|
||||
int result;
|
||||
const char *audioDriver;
|
||||
SDL_AudioSpec desired;
|
||||
const char *hint = SDL_GetHint(SDL_HINT_AUDIO_DRIVER);
|
||||
|
||||
/* Stop SDL audio subsystem */
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
@ -246,6 +257,10 @@ static int audio_pauseUnpauseAudio(void *arg)
|
||||
SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL");
|
||||
SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */
|
||||
|
||||
if (hint && SDL_strcmp(audioDriver, hint) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Change specs */
|
||||
for (j = 0; j < 2; j++) {
|
||||
|
||||
@ -340,7 +355,7 @@ static int audio_pauseUnpauseAudio(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Enumerate and name available audio devices (output and capture).
|
||||
* Enumerate and name available audio devices (output and capture).
|
||||
*
|
||||
* \sa SDL_GetNumAudioDevices
|
||||
* \sa SDL_GetAudioDeviceName
|
||||
@ -381,7 +396,7 @@ static int audio_enumerateAndNameAudioDevices(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Negative tests around enumeration and naming of audio devices.
|
||||
* Negative tests around enumeration and naming of audio devices.
|
||||
*
|
||||
* \sa SDL_GetNumAudioDevices
|
||||
* \sa SDL_GetAudioDeviceName
|
||||
@ -392,7 +407,7 @@ static int audio_enumerateAndNameAudioDevicesNegativeTests(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Checks available audio driver names.
|
||||
* Checks available audio driver names.
|
||||
*
|
||||
* \sa SDL_GetNumAudioDrivers
|
||||
* \sa SDL_GetAudioDriver
|
||||
@ -423,7 +438,7 @@ static int audio_printAudioDrivers(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Checks current audio driver name with initialized audio.
|
||||
* Checks current audio driver name with initialized audio.
|
||||
*
|
||||
* \sa SDL_GetCurrentAudioDriver
|
||||
*/
|
||||
@ -470,7 +485,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_F32LE_FORMAT, SDL_AUDIO_F32LE == (SDL_AUDIO_BI
|
||||
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_F32BE_FORMAT, SDL_AUDIO_F32BE == (SDL_AUDIO_F32LE | SDL_AUDIO_MASK_BIG_ENDIAN));
|
||||
|
||||
/**
|
||||
* \brief Builds various audio conversion structures
|
||||
* Builds various audio conversion structures
|
||||
*
|
||||
* \sa SDL_CreateAudioStream
|
||||
*/
|
||||
@ -481,6 +496,10 @@ static int audio_buildAudioStream(void *arg)
|
||||
SDL_AudioSpec spec2;
|
||||
int i, ii, j, jj, k, kk;
|
||||
|
||||
/* Call Quit */
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)");
|
||||
|
||||
/* No conversion needed */
|
||||
spec1.format = SDL_AUDIO_S16LE;
|
||||
spec1.channels = 2;
|
||||
@ -528,11 +547,14 @@ static int audio_buildAudioStream(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Restart audio again */
|
||||
audioSetUp(NULL);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Checks calls with invalid input to SDL_CreateAudioStream
|
||||
* Checks calls with invalid input to SDL_CreateAudioStream
|
||||
*
|
||||
* \sa SDL_CreateAudioStream
|
||||
*/
|
||||
@ -612,7 +634,7 @@ static int audio_buildAudioStreamNegative(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Checks current audio status.
|
||||
* Checks current audio status.
|
||||
*
|
||||
* \sa SDL_GetAudioDeviceStatus
|
||||
*/
|
||||
@ -622,7 +644,7 @@ static int audio_getAudioStatus(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Opens, checks current audio status, and closes a device.
|
||||
* Opens, checks current audio status, and closes a device.
|
||||
*
|
||||
* \sa SDL_GetAudioStatus
|
||||
*/
|
||||
@ -632,7 +654,7 @@ static int audio_openCloseAndGetAudioStatus(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Locks and unlocks open audio device.
|
||||
* Locks and unlocks open audio device.
|
||||
*
|
||||
* \sa SDL_LockAudioDevice
|
||||
* \sa SDL_UnlockAudioDevice
|
||||
@ -643,7 +665,7 @@ static int audio_lockUnlockOpenAudioDevice(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convert audio using various conversion structures
|
||||
* Convert audio using various conversion structures
|
||||
*
|
||||
* \sa SDL_CreateAudioStream
|
||||
*/
|
||||
@ -777,7 +799,7 @@ static int audio_convertAudio(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Opens, checks current connected status, and closes a device.
|
||||
* Opens, checks current connected status, and closes a device.
|
||||
*
|
||||
* \sa SDL_AudioDeviceConnected
|
||||
*/
|
||||
@ -799,7 +821,7 @@ static double sine_wave_sample(const Sint64 idx, const Sint64 rate, const Sint64
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check signal-to-noise ratio and maximum error of audio resampling.
|
||||
* Check signal-to-noise ratio and maximum error of audio resampling.
|
||||
*
|
||||
* \sa https://wiki.libsdl.org/SDL_CreateAudioStream
|
||||
* \sa https://wiki.libsdl.org/SDL_DestroyAudioStream
|
||||
@ -956,7 +978,7 @@ static int audio_resampleLoss(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check accuracy converting between audio formats.
|
||||
* Check accuracy converting between audio formats.
|
||||
*
|
||||
* \sa SDL_ConvertAudioSamples
|
||||
*/
|
||||
@ -1091,7 +1113,7 @@ static int audio_convertAccuracy(void *arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check accuracy when switching between formats
|
||||
* Check accuracy when switching between formats
|
||||
*
|
||||
* \sa SDL_SetAudioStreamFormat
|
||||
*/
|
||||
|
Reference in New Issue
Block a user