faudio: Return PCM format from IXAudio27_GetDeviceDetails.
This will be in next FAudio release. This fixes a regression in some games, such as Far Cry 4, where audio doesn't work anymore since the move to FAudio Win32 platform. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
508e97a249
commit
f6482d1c45
|
@ -940,7 +940,6 @@ static UINT32 test_DeviceDetails(IXAudio27 *xa)
|
|||
else
|
||||
ok(dd.Role == NotDefaultDevice, "Got wrong role for index %u: 0x%x\n", i, dd.Role);
|
||||
|
||||
todo_wine
|
||||
ok(IsEqualGUID(&dd.OutputFormat.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM),
|
||||
"got format %s\n", debugstr_guid(&dd.OutputFormat.SubFormat));
|
||||
}
|
||||
|
|
|
@ -364,13 +364,14 @@ uint32_t FAudio_PlatformGetDeviceDetails(
|
|||
uint32_t index,
|
||||
FAudioDeviceDetails *details
|
||||
) {
|
||||
WAVEFORMATEX *format, *obtained;
|
||||
WAVEFORMATEXTENSIBLE *ext;
|
||||
WAVEFORMATEX *format;
|
||||
IAudioClient *client;
|
||||
IMMDevice *device;
|
||||
uint32_t ret = 0;
|
||||
HRESULT hr;
|
||||
WCHAR *str;
|
||||
GUID sub;
|
||||
|
||||
FAudio_memset(details, 0, sizeof(FAudioDeviceDetails));
|
||||
if (index > 0) return FAUDIO_E_INVALID_CALL;
|
||||
|
@ -406,6 +407,28 @@ uint32_t FAudio_PlatformGetDeviceDetails(
|
|||
hr = IAudioClient_GetMixFormat(client, &format);
|
||||
FAudio_assert(!FAILED(hr) && "Failed to get audio client mix format!");
|
||||
|
||||
if (format->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
|
||||
{
|
||||
ext = (WAVEFORMATEXTENSIBLE *)format;
|
||||
sub = ext->SubFormat;
|
||||
FAudio_memcpy(
|
||||
&ext->SubFormat,
|
||||
&DATAFORMAT_SUBTYPE_PCM,
|
||||
sizeof(GUID)
|
||||
);
|
||||
|
||||
hr = IAudioClient_IsFormatSupported(client, AUDCLNT_SHAREMODE_SHARED, format, &obtained);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ext->SubFormat = sub;
|
||||
}
|
||||
else if (obtained)
|
||||
{
|
||||
CoTaskMemFree(format);
|
||||
format = obtained;
|
||||
}
|
||||
}
|
||||
|
||||
details->OutputFormat.Format.wFormatTag = format->wFormatTag;
|
||||
details->OutputFormat.Format.nChannels = format->nChannels;
|
||||
details->OutputFormat.Format.nSamplesPerSec = format->nSamplesPerSec;
|
||||
|
@ -426,6 +449,8 @@ uint32_t FAudio_PlatformGetDeviceDetails(
|
|||
);
|
||||
}
|
||||
|
||||
CoTaskMemFree(format);
|
||||
|
||||
IAudioClient_Release(client);
|
||||
|
||||
IMMDevice_Release(device);
|
||||
|
|
Loading…
Reference in New Issue