audio: 3- and 5-channel formats are now supported

main
Ethan Lee 2022-07-20 19:08:31 -04:00 committed by GitHub
parent 45c3b59d4b
commit f3008e4aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 15 deletions

View File

@ -1240,22 +1240,12 @@ prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared)
} }
} }
switch (orig->channels) { if (orig->channels == 0) {
case 0:{ const char *env = SDL_getenv("SDL_AUDIO_CHANNELS");
const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) {
if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) { prepared->channels = 2; /* a reasonable default */
prepared->channels = 2; /* a reasonable default */
break;
}
} }
case 1: /* Mono */ } else if (orig->channels > 8) {
case 2: /* Stereo */
case 4: /* Quadrophonic */
case 6: /* 5.1 surround */
case 7: /* 6.1 surround */
case 8: /* 7.1 surround */
break;
default:
SDL_SetError("Unsupported number of audio channels."); SDL_SetError("Unsupported number of audio channels.");
return 0; return 0;
} }