WASAPI ~2-3s delays on creating audio devices

Experiencing long delays when creating WASAPI audio devices. For example, when changing audio devices in DemoRunner.

Firstly, a few seconds are spent repeatedly trying formats where each time calling IAuidioClient::IsFormatSupported takes ~10ms:


In profiler:

After that a few hundreds of milliseconds are spent inside a call to IAuidioClient::Initialize:


In profiler:

Also, with defined JUCE_WASAPI_LOGGING=1 a lot of “WASAPI error: AUDCLNT_E_UNSUPPORTED_FORMAT” show up during creation of devices.

Could someone help with this issue or maybe point out in which direction to look?I