diff --git a/source/audiolib/src/_multivc.h b/source/audiolib/src/_multivc.h index 12a8354f7..d094377c0 100644 --- a/source/audiolib/src/_multivc.h +++ b/source/audiolib/src/_multivc.h @@ -37,9 +37,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define VOC_16BIT 0x4 #define T_SIXTEENBIT_STEREO 0 -#define T_MONO 2 -#define T_16BITSOURCE 4 -#define T_STEREOSOURCE 8 +#define T_MONO 1 +#define T_16BITSOURCE 2 +#define T_STEREOSOURCE 4 #define T_DEFAULT T_SIXTEENBIT_STEREO #define MV_MAXPANPOSITION 127 /* formerly 31 */ diff --git a/source/audiolib/src/multivoc.cpp b/source/audiolib/src/multivoc.cpp index 6fb136d3e..49ff0a965 100644 --- a/source/audiolib/src/multivoc.cpp +++ b/source/audiolib/src/multivoc.cpp @@ -574,26 +574,12 @@ void MV_SetVoiceMixMode(VoiceNode *voice) if (voice->channels == 2) type |= T_STEREOSOURCE; - switch (type) - { - case T_16BITSOURCE | T_MONO: voice->mix = MV_Mix16BitMono16; break; + // stereo look-up table + static constexpr decltype(voice->mix) mixslut[] + = { MV_Mix16BitStereo, MV_Mix16BitMono, MV_Mix16BitStereo16, MV_Mix16BitMono16, + MV_Mix16BitStereo8Stereo, MV_Mix16BitMono8Stereo, MV_Mix16BitStereo16Stereo, MV_Mix16BitMono16Stereo }; - case T_MONO: voice->mix = MV_Mix16BitMono; break; - - case T_16BITSOURCE: voice->mix = MV_Mix16BitStereo16; break; - - case T_SIXTEENBIT_STEREO: voice->mix = MV_Mix16BitStereo; break; - - case T_16BITSOURCE | T_STEREOSOURCE: voice->mix = MV_Mix16BitStereo16Stereo; break; - - case T_16BITSOURCE | T_STEREOSOURCE | T_MONO: voice->mix = MV_Mix16BitMono16Stereo; break; - - case T_STEREOSOURCE: voice->mix = MV_Mix16BitStereo8Stereo; break; - - case T_STEREOSOURCE | T_MONO: voice->mix = MV_Mix16BitMono8Stereo; break; - - default: voice->mix = NULL; break; - } + voice->mix = mixslut[type]; } void MV_SetVoiceVolume(VoiceNode *voice, int32_t vol, int32_t left, int32_t right, float volume)