SDL icon indicating copy to clipboard operation
SDL copied to clipboard

audio issue with wasapi and Intel Display Audio devices

Open sezero opened this issue 2 years ago • 5 comments

This was reported to me by @j4reporting for quakespasm at https://github.com/sezero/quakespasm/issues/23 - any insights?

Quoting as is:


Audio is not initialized on WIndows if 'Intel display audio' is the only available audio device AND a modeset is issued. This is a known issue with Intel Drivers (see Intel document ).

Sound Initlalisation
Coundn't opem SDL audio:  WASAPI can't find requested audio endpoint: Element not found.

I could fix this by simply retrying again 2 seconds later.

Unfortunately audio device is also lost later in the game when switching to another video resolution or switching from vid_fullscreen 0 <-> 1. What is needed is some kind of snd_restart command and ideally a check if the audio device is available and if not, an automatic restart of the audio device.

the same issue can be observed with vkQuake, Ironwail and probably with other forks.

Why had that worked for me all this years? I had a headphone connected to the system (realtek HD audio) and Quakespasm would find the headphone, initialize audio and when Intel Display Audio re-apperared, SDL/ WASAPI would switch back to the default audio device!


sezero avatar Apr 22 '22 22:04 sezero

This is wild! So for up to 8 seconds after changing the display resolution, the audio device goes missing...? Wow.

This feels like something we should look for by vendor id and add some special case code for.

icculus avatar Apr 23 '22 00:04 icculus

If I'm reading the linked docs correctly, Intel says they are innocent and blame apps. Never heard this kind of an issue though, until today - so I'm not 100% sure about who to blame - quakespasm or intel drivers or SDL.

sezero avatar Apr 23 '22 01:04 sezero

The suggestion that you should retry for more than 8 seconds after a modeset just seems baffling. How is that an OK user experience? "The spec allows it and gosh darned it we're going to use every second!" -- Intel

eloj avatar Apr 23 '22 11:04 eloj

Yeah, this is 100% Intel's fault but we can probably handle this as a special case. I'll look into it.

icculus avatar Apr 23 '22 12:04 icculus

The 'good' news is that I cannot reproduce this strange behaviour on an 11th Gen Core system ( Xe iGPU). The audio device now has the name 'HD Audio Driver for Display Audio' instead of 'Intel Display Audio' on previous Core generations. The architecture of the new driver looks similar to the NVidia driver. I suspect that Intel's 6th to 10th Gen Core CPUs are affected.

The OpenAL-soft library has some extensions that allow to recover a temporarily disconnected or unavailable audio device.

How is that an OK user experience?

normally this is not a big problem. On my old Skylake system (NUC 6I5SYH) and a QHD display, the audio device is available 1-2 seconds after the monitor exits the modeset. It is quite possible that Intel also includes the duration that the monitor needs for the modeset.

j4reporting avatar Jun 02 '22 17:06 j4reporting

I'm just noting, having messed around with HDMI audio more recently, that it's extremely common for it to take a few seconds to get audio going when switching to such an audio device; I've seen this on Windows, Linux and macOS...the difference is that the OS level device doesn't vanish or fail, it just doesn't make any sound until it's ready, and I think that's the crux of the issue here.

For now, I'm going to pass on trying to workaround this in SDL, as it seems to be an older hardware issue, and we're continuing to push towards people using fullscreen_desktop instead of changing the resolution, which should avoid this bug.

I'm not closing this as WONTFIX yet, in case it's more widespread than I assume, but I'm bumping from the milestone.

icculus avatar Nov 16 '22 04:11 icculus

I think this can be split in two issues

  1. the initial SDL_OpenAudio call when the Intel audio device is not yet available shortly after the modeset usually I can fix this in source with 2nd try after a short delay of 1-2 seconds

  2. losing an already aquired audio device after another modeset later on (e.g. changing program's video resolution ) for some reason only wasapi is affected. SDL_AUDIODRIVER=directsound works can this be related to https://github.com/libsdl-org/SDL/issues/7044 ?

I have not tested this myself, but I guess a driver like Virtual Audio Cable https://vb-audio.com/Cable/ may be a good workaround for affected systems. Virtual Audio Cable will be the system's default audio device, always available, and the output can be forwarded to the Intel Audio device.

j4reporting avatar May 15 '23 14:05 j4reporting

(Following up from #7044, we should be good here, too, but please let me know if this issue still persists!)

icculus avatar May 26 '23 23:05 icculus