mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-20 15:51:07 +01:00
Additional cleanup exposed by building with a C++ compiler
This commit is contained in:
@@ -430,23 +430,6 @@ static void RepositionRowOfThings(const ThingType what, const float y)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *AudioFmtToString(const SDL_AudioFormat fmt)
|
||||
{
|
||||
switch (fmt) {
|
||||
#define FMTCASE(x) case SDL_AUDIO_##x: return #x
|
||||
FMTCASE(U8);
|
||||
FMTCASE(S8);
|
||||
FMTCASE(S16LE);
|
||||
FMTCASE(S16BE);
|
||||
FMTCASE(S32LE);
|
||||
FMTCASE(S32BE);
|
||||
FMTCASE(F32LE);
|
||||
FMTCASE(F32BE);
|
||||
#undef FMTCASE
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
static const char *AudioChansToStr(const int channels)
|
||||
{
|
||||
switch (channels) {
|
||||
@@ -686,7 +669,7 @@ static Thing *LoadWavThing(const char *fname, float x, float y)
|
||||
nodirs = fname;
|
||||
}
|
||||
|
||||
SDL_asprintf(&titlebar, "WAV file (\"%s\", %s, %s, %uHz)", nodirs, AudioFmtToString(spec.format), AudioChansToStr(spec.channels), (unsigned int) spec.freq);
|
||||
SDL_asprintf(&titlebar, "WAV file (\"%s\", %s, %s, %uHz)", nodirs, SDL_GetAudioFormatName(spec.format), AudioChansToStr(spec.channels), (unsigned int) spec.freq);
|
||||
thing = CreateThing(THING_WAV, x - (audio_texture->w / 2), y - (audio_texture->h / 2), 5, -1, -1, audio_texture, titlebar);
|
||||
if (thing) {
|
||||
SDL_free(titlebar);
|
||||
@@ -772,7 +755,7 @@ static void SetLogicalDeviceTitlebar(Thing *thing)
|
||||
int frames = 0;
|
||||
SDL_GetAudioDeviceFormat(thing->data.logdev.devid, spec, &frames);
|
||||
SDL_free(thing->titlebar);
|
||||
SDL_asprintf(&thing->titlebar, "Logical device #%u (%s, %s, %s, %uHz, %d frames)", (unsigned int) thing->data.logdev.devid, thing->data.logdev.recording ? "RECORDING" : "PLAYBACK", AudioFmtToString(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
SDL_asprintf(&thing->titlebar, "Logical device #%u (%s, %s, %s, %uHz, %d frames)", (unsigned int) thing->data.logdev.devid, thing->data.logdev.recording ? "RECORDING" : "PLAYBACK", SDL_GetAudioFormatName(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
}
|
||||
|
||||
static void LogicalDeviceThing_ondrop(Thing *thing, int button, float x, float y)
|
||||
@@ -959,11 +942,11 @@ static void SetPhysicalDeviceTitlebar(Thing *thing)
|
||||
SDL_GetAudioDeviceFormat(thing->data.physdev.devid, spec, &frames);
|
||||
SDL_free(thing->titlebar);
|
||||
if (thing->data.physdev.devid == SDL_AUDIO_DEVICE_DEFAULT_RECORDING) {
|
||||
SDL_asprintf(&thing->titlebar, "Default system device (RECORDING, %s, %s, %uHz, %d frames)", AudioFmtToString(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
SDL_asprintf(&thing->titlebar, "Default system device (RECORDING, %s, %s, %uHz, %d frames)", SDL_GetAudioFormatName(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
} else if (thing->data.physdev.devid == SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK) {
|
||||
SDL_asprintf(&thing->titlebar, "Default system device (PLAYBACK, %s, %s, %uHz, %d frames)", AudioFmtToString(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
SDL_asprintf(&thing->titlebar, "Default system device (PLAYBACK, %s, %s, %uHz, %d frames)", SDL_GetAudioFormatName(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
} else {
|
||||
SDL_asprintf(&thing->titlebar, "Physical device #%u (%s, \"%s\", %s, %s, %uHz, %d frames)", (unsigned int) thing->data.physdev.devid, thing->data.physdev.recording ? "RECORDING" : "PLAYBACK", thing->data.physdev.name, AudioFmtToString(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
SDL_asprintf(&thing->titlebar, "Physical device #%u (%s, \"%s\", %s, %s, %uHz, %d frames)", (unsigned int) thing->data.physdev.devid, thing->data.physdev.recording ? "RECORDING" : "PLAYBACK", thing->data.physdev.name, SDL_GetAudioFormatName(spec->format), AudioChansToStr(spec->channels), (unsigned int) spec->freq, frames);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user