From f3008e4aabf76f3c3cf2c57d8f01990e779cf477 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 20 Jul 2022 19:08:31 -0400 Subject: [PATCH] audio: 3- and 5-channel formats are now supported --- src/audio/SDL_audio.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 9c47d40ba..949d650f8 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1240,22 +1240,12 @@ prepare_audiospec(const SDL_AudioSpec * orig, SDL_AudioSpec * prepared) } } - switch (orig->channels) { - case 0:{ - const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); - if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) { - prepared->channels = 2; /* a reasonable default */ - break; - } + if (orig->channels == 0) { + const char *env = SDL_getenv("SDL_AUDIO_CHANNELS"); + if ((!env) || ((prepared->channels = (Uint8) SDL_atoi(env)) == 0)) { + prepared->channels = 2; /* a reasonable default */ } - case 1: /* Mono */ - case 2: /* Stereo */ - case 4: /* Quadrophonic */ - case 6: /* 5.1 surround */ - case 7: /* 6.1 surround */ - case 8: /* 7.1 surround */ - break; - default: + } else if (orig->channels > 8) { SDL_SetError("Unsupported number of audio channels."); return 0; }