From: Giovanni Mascellani gmascellani@codeweavers.com
Despite its name, IsFormatSupported() doesn't really predict what Initialize() will return, especially when AUTOCONVERTPCM is used. So there's no point querying it, let's just call Initialize() and that will tell whether the format is accepted or not.
It is also useless to change to the recommended format: both if we're going to use a primary buffer or not, the format that is computer in DSOUND_WaveFormat() is what everything else expects, and if it cannot be satisfied there's not point continuing. --- dlls/dsound/primary.c | 11 ----------- 1 file changed, 11 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 340e00bd8a0..f450dcaa388 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -110,7 +110,6 @@ static DWORD DSOUND_FindSpeakerConfig(IMMDevice *mmdevice, int channels) static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client, BOOL forcewave, WAVEFORMATEX **wfx) { - WAVEFORMATEXTENSIBLE *retwfe = NULL; WAVEFORMATEX *w; HRESULT hr;
@@ -170,16 +169,6 @@ static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client if (!w) return DSERR_OUTOFMEMORY;
- hr = IAudioClient_IsFormatSupported(client, AUDCLNT_SHAREMODE_SHARED, w, (WAVEFORMATEX**)&retwfe); - if (retwfe) { - memcpy(w, retwfe, sizeof(WAVEFORMATEX) + retwfe->Format.cbSize); - CoTaskMemFree(retwfe); - } - if (FAILED(hr)) { - WARN("IsFormatSupported failed: %08lx\n", hr); - free(w); - return hr; - } *wfx = w; return S_OK; }