mirror of https://github.com/libsdl-org/SDL.git
Simplify get_channel_name() so it's easier for people to read and understand
This commit is contained in:
parent
c134dd6e5e
commit
45584ad73e
|
|
@ -27,65 +27,111 @@ static int active_channel;
|
||||||
#define LFE_SINE_FREQ_HZ 50
|
#define LFE_SINE_FREQ_HZ 50
|
||||||
|
|
||||||
/* The channel layout is defined in SDL_audio.h */
|
/* The channel layout is defined in SDL_audio.h */
|
||||||
static const char *
|
static const char *get_channel_name(int channel_index, int channel_count)
|
||||||
get_channel_name(int channel_index, int channel_count)
|
|
||||||
{
|
{
|
||||||
switch (channel_index) {
|
switch (channel_count) {
|
||||||
case 0:
|
|
||||||
return "Front Left";
|
|
||||||
case 1:
|
case 1:
|
||||||
return "Front Right";
|
return "Mono";
|
||||||
case 2:
|
case 2:
|
||||||
switch (channel_count) {
|
switch (channel_index) {
|
||||||
case 3:
|
case 0:
|
||||||
case 5:
|
return "Front Left";
|
||||||
return "Low Frequency Effects";
|
case 1:
|
||||||
case 4:
|
return "Front Right";
|
||||||
return "Back Left";
|
|
||||||
default:
|
|
||||||
return "Front Center";
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
switch (channel_count) {
|
switch (channel_index) {
|
||||||
case 4:
|
case 0:
|
||||||
return "Back Right";
|
return "Front Left";
|
||||||
case 5:
|
case 1:
|
||||||
return "Back Left";
|
return "Front Right";
|
||||||
default:
|
case 2:
|
||||||
return "Low Frequency Effects";
|
return "Low Frequency Effects";
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
switch (channel_count) {
|
switch (channel_index) {
|
||||||
case 5:
|
case 0:
|
||||||
return "Back Right";
|
return "Front Left";
|
||||||
case 6:
|
case 1:
|
||||||
return "Side Left";
|
return "Front Right";
|
||||||
case 7:
|
case 2:
|
||||||
return "Back Center";
|
|
||||||
case 8:
|
|
||||||
return "Back Left";
|
return "Back Left";
|
||||||
|
case 3:
|
||||||
|
return "Back Right";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
switch (channel_count) {
|
switch (channel_index) {
|
||||||
case 6:
|
case 0:
|
||||||
return "Side Right";
|
return "Front Left";
|
||||||
case 7:
|
case 1:
|
||||||
return "Side Left";
|
return "Front Right";
|
||||||
case 8:
|
case 2:
|
||||||
|
return "Low Frequency Effects";
|
||||||
|
case 3:
|
||||||
|
return "Back Left";
|
||||||
|
case 4:
|
||||||
return "Back Right";
|
return "Back Right";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
switch (channel_count) {
|
switch (channel_index) {
|
||||||
case 7:
|
case 0:
|
||||||
return "Side Right";
|
return "Front Left";
|
||||||
case 8:
|
case 1:
|
||||||
return "Side Left";
|
return "Front Right";
|
||||||
|
case 2:
|
||||||
|
return "Front Center";
|
||||||
|
case 3:
|
||||||
|
return "Low Frequency Effects";
|
||||||
|
case 4:
|
||||||
|
return "Back Left";
|
||||||
|
case 5:
|
||||||
|
return "Back Right";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
return "Side Right";
|
switch (channel_index) {
|
||||||
|
case 0:
|
||||||
|
return "Front Left";
|
||||||
|
case 1:
|
||||||
|
return "Front Right";
|
||||||
|
case 2:
|
||||||
|
return "Front Center";
|
||||||
|
case 3:
|
||||||
|
return "Low Frequency Effects";
|
||||||
|
case 4:
|
||||||
|
return "Back Center";
|
||||||
|
case 5:
|
||||||
|
return "Side Left";
|
||||||
|
case 6:
|
||||||
|
return "Side Right";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
switch (channel_index) {
|
||||||
|
case 0:
|
||||||
|
return "Front Left";
|
||||||
|
case 1:
|
||||||
|
return "Front Right";
|
||||||
|
case 2:
|
||||||
|
return "Front Center";
|
||||||
|
case 3:
|
||||||
|
return "Low Frequency Effects";
|
||||||
|
case 4:
|
||||||
|
return "Back Left";
|
||||||
|
case 5:
|
||||||
|
return "Back Right";
|
||||||
|
case 6:
|
||||||
|
return "Side Left";
|
||||||
|
case 7:
|
||||||
|
return "Side Right";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
SDLTest_AssertCheck(false, "Invalid channel_index for channel_count: channel_count=%d channel_index=%d", channel_count, channel_index);
|
SDLTest_AssertCheck(false, "Invalid channel_index for channel_count: channel_count=%d channel_index=%d", channel_count, channel_index);
|
||||||
SDL_assert(0);
|
SDL_assert(0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue