[PATCH] dsound: copy program parameters in SetFormat
Maarten Lankhorst
maarten.lankhorst at canonical.com
Mon Feb 11 07:06:42 CST 2013
Fixes bug #32312, apparently some programs depend on the format it specifies being returned.
Just set wBitsPerSample, nSamplesPerSec and nChannels to make those applications happy.
---
--- a/dlls/dsound/primary.c
+++ a/dlls/dsound/primary.c
@@ -454,10 +454,15 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
if (IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) &&
passed_fmt->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) {
fmt->wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
+ fmt->wBitsPerSample = 32;
} else {
fmt->wFormatTag = WAVE_FORMAT_PCM;
- fmt->wBitsPerSample = 16;
+ fmt->wBitsPerSample = passed_fmt->wBitsPerSample;
}
+ fmt->nSamplesPerSec = passed_fmt->nSamplesPerSec;
+ fmt->nChannels = passed_fmt->nChannels;
+ if (fmt->nChannels > device->pwfx->nChannels)
+ fmt->nChannels = device->pwfx->nChannels;
fmt->nBlockAlign = fmt->nChannels * fmt->wBitsPerSample / 8;
fmt->nAvgBytesPerSec = fmt->nBlockAlign * fmt->nSamplesPerSec;
fmt->cbSize = 0;
More information about the wine-patches
mailing list