When I use the Windows WASAPI's function IAudioClient::Initialize to initialize a capture stream on an audio device, it sometimes takes several seconds to return successfully, although normally it only takes several hundred milliseconds. The code I used is listed below:
// Create a capturing stream.
hr = _ptrClientIn->Initialize(AUDCLNT_SHAREMODE_SHARED,
AUDCLNT_STREAMFLAGS_EVENTCALLBACK |
AUDCLNT_STREAMFLAGS_NOPERSIST,
0,
0,
(WAVEFORMATEX*)&Wfx,
NULL);
Not sure why the same function calls can vary some much.