From dba76c1aea8fe8e9699d81eee67eeb95d383fa5d Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 22 Apr 2015 18:32:45 -0500 Subject: [PATCH] Disable PCM-8 output when not using DirectSound - PCM-8 sounds like garbage with WASAPI and WaveOut, so force anything not DirectSound to use PCM-16 if PCM-8 is selected. --- src/sound/fmodsound.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index b5af6a4859..49d53117f5 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -895,6 +895,15 @@ bool FMODSoundRenderer::Init() // Set software format eval = Enum_NumForName(SoundFormatNames, snd_output_format); format = eval >= 0 ? FMOD_SOUND_FORMAT(eval) : FMOD_SOUND_FORMAT_PCM16; + if (format == FMOD_SOUND_FORMAT_PCM8) + { + // PCM-8 sounds like garbage with anything but DirectSound. + FMOD_OUTPUTTYPE output; + if (FMOD_OK != Sys->getOutput(&output) || output != FMOD_OUTPUTTYPE_DSOUND) + { + format = FMOD_SOUND_FORMAT_PCM16; + } + } eval = Enum_NumForName(ResamplerNames, snd_resampler); resampler = eval >= 0 ? FMOD_DSP_RESAMPLER(eval) : FMOD_DSP_RESAMPLER_LINEAR; // These represented the frequency limits for hardware channels, which we never used anyway.