cpal
cpal copied to clipboard
WinAPI returns OS Error -2004287480 (FormatMessageW() returned error 317)
While testing some examples I ran into a runtime error of:
Error: The requested stream configuration is not supported by the device.
I traced through and found that the WinApi's IAudioClient would return this error when calling IsFormatSupported:
code: -2004287480, kind: Other, message: "OS Error -2004287480 (FormatMessageW() returned error 317)"
Not sure if this belongs on the WinAPI crate or this one, however, ignoring this error results in the sound being played correctly. So it seems that not all errors returned by the WinAPI crate (and therefore, the windows operating system) necessarily prevent the use of a given device.
My Machine: Windows 10 Intel i7 Nvidia GTX 1060
Edit: I can confirm that this does not happen on MacOS
Thanks
Please add details about your sound card or sound driver.
Using the Arctis 7 headset, which has registers as two separate devices: Game & Chat. This error only appear when using the Chat device. I have confirmed that the most up to date driver is installed. I've attached the last event on the device, and this is the info from the Driver File Details page for this device:
C:\WINDOWS\system32\DRIVERS\dmk.sys C:\WINDOWS\system32\drivers\ksthunk.sys C:\WINDOWS\system32\DRIVERS\portcls.sys C:\WINDOWS\system32\drivers\USBAUDIO.sys C:\WINDOWS\system32\SysFxUI.dll C:\WINDOWS\system32\WMALFXGFXDSP.dll
Provider: Microsoft Corporation File Version: 10.0.18362.1 (WinBuild.160101.0800)
Last Event: Device USB\VID_1038&PID_12AD&MI_00\6&d4ae78b&0&0000 was configured.
Driver Name: wdma_usb.inf Class Guid: {4d36e96c-e325-11ce-bfc1-08002be10318} Driver Date: 03/18/2019 Driver Version: 10.0.18362.1 Driver Provider: Microsoft Driver Section: USBAudio Driver Rank: 0xFF2002 Matching Device Id: USB\Class_01 Outranked Drivers: Device Updated: false Parent Device: USB\VID_1038&PID_12AD\5&dc4a972&0&2
Let me know if there's any more info I can provide.
If you're running the feedback
example, this might be the culprit.
I was running the “beep.rs” example. Have not tried if input fails, but this panics only on the “Chat” output (not the “Game” output). For now I’ve just safe-guarded against this possibility by catching the possible panic.
The error seems to be a driver issue (either bad installation or bug).
We could try to workaround that. Can you give a backtrace so we could add that ignoring logic there?
As usual, as a bonus we want to have references about other library doing the same workaround.
Sorry for reviving such an old thread. I just want to say I have the same error with the same headset and same audio device. So pretty sure it is an issue with their driver.
The HRESULT returned from winapi-0.3.9 IAudioClient::IsFormatSupported is in my case -2004287480 and closest_waveformatex_ptr is null.
Which is not a combination that should exist according to the documentation as far as I understand. So not sure if something can be done.
Anything I could do to help in debugging?
The only solution that I have found would be to try to catch the error. It seems like it would be nice to have this error catching within the CPAL library, but yes, I can confirm that this is most likely a driver issue with some sort of compatibility layer with the OS.