From: Mark Harmstone Subject: [PATCH] winealsa: fix input sound distortion and heap corruption Message-Id: <545C455F.1050201@burntcomma.com> Date: Fri, 07 Nov 2014 04:06:55 +0000 At present, winealsa attempts to call map_channels when a capture device is opened. If a microphone can be opened in either stereo or mono mode, and mono is requested, Wine will still return stereo data. Not only does this result in distorted in audio, it also very frequently results in heap corruption when snd_pcm_readi overruns the buffer allocated by the program. I don't have a copy of World of Warcraft to test this on, but this may also fix bug 31684. It's the same symptoms, at least. --- dlls/winealsa.drv/mmdevdrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index a4c02bf..91fba2f 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -1164,7 +1164,7 @@ static DWORD get_channel_mask(unsigned int channels) static HRESULT map_channels(ACImpl *This, const WAVEFORMATEX *fmt) { - if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE || fmt->nChannels > 2){ + if( (This->dataflow != eCapture && fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) || fmt->nChannels > 2){ WAVEFORMATEXTENSIBLE *fmtex = (void*)fmt; DWORD mask, flag = SPEAKER_FRONT_LEFT; UINT i = 0; -- 2.0.4