mirror of https://github.com/libsdl-org/SDL.git
diskaudio: Use SDL_GetAudioFormatName instead of recreating it from scratch.
This commit is contained in:
parent
f05bb7aae2
commit
8eb57c5a42
|
|
@ -102,20 +102,12 @@ static const char *get_filename(const bool recording)
|
||||||
|
|
||||||
static const char *AudioFormatString(SDL_AudioFormat fmt)
|
static const char *AudioFormatString(SDL_AudioFormat fmt)
|
||||||
{
|
{
|
||||||
switch (fmt) {
|
const char *str = SDL_GetAudioFormatName(fmt);
|
||||||
#define CHECK_FMT(x) case SDL_AUDIO_##x: return #x
|
SDL_assert(str);
|
||||||
CHECK_FMT(U8);
|
if (SDL_strncmp(str, "SDL_AUDIO_", 10) == 0) {
|
||||||
CHECK_FMT(S8);
|
str += 10; // so we return "S8" instead of "SDL_AUDIO_S8", etc.
|
||||||
CHECK_FMT(S16LE);
|
|
||||||
CHECK_FMT(S16BE);
|
|
||||||
CHECK_FMT(S32LE);
|
|
||||||
CHECK_FMT(S32BE);
|
|
||||||
CHECK_FMT(F32LE);
|
|
||||||
CHECK_FMT(F32BE);
|
|
||||||
#undef CHECK_FMT
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
return "[unknown]";
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool DISKAUDIO_OpenDevice(SDL_AudioDevice *device)
|
static bool DISKAUDIO_OpenDevice(SDL_AudioDevice *device)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue