libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.05k stars 1.81k forks source link

Windows default audio device issue/crash #3392

Open AlertDOTEXE opened 8 years ago

AlertDOTEXE commented 8 years ago

When utilizing two different audio devices and setting one to default, Retroarch will use it just fine. When changing the which audio device is default while running, two things may happen. Retroarch may not switch to the different default audio device, or Retroarch will crash altogether.

Specifically to me, I use bluetooth earphones on my laptop and most of the time it is the default audio device. When I turn them off, the laptop speakers automatically become default. When this happens while Retroarch is running, Retroarch will crash every time.

When having the laptop speakers as the default audio device initially, then run Retroarch and then change the default audio device by turning on my bluetooth earphones, Retroarch does not crash, but the audio does not transfer to the earphones even though it is the default audio device.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/37015803-windows-default-audio-device-issue-crash?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
Monroe88 commented 8 years ago

This looks like an xaudio bug, because dsound and sdl2 drivers don't have problems switching audio devices. With xaudio, forcing a driver reinit (i.e. toggling fullscreen) updates the audio device.

There appears to be a difference in the way that DirectSound and XAudio2 enumerates audio devices, perhaps that's the issue:

RetroArch [INFO] :: DirectSound devices:
RetroArch [INFO] ::     0: Primary Sound Driver
RetroArch [INFO] ::     1: Realtek HD Audio 2nd output (Realtek High Definition Audio)
RetroArch [INFO] ::     2: Realtek Digital Output (Realtek High Definition Audio)
RetroArch [INFO] ::     3: Speakers (Realtek High Definition Audio)

XAudio2 devices:
    0: Realtek HD Audio 2nd output (Realtek High Definition Audio)
    1: Realtek Digital Output (Realtek High Definition Audio)
    2: Speakers (Realtek High Definition Audio)
lotharsm commented 7 years ago

I can confirm this. This still happens on latest RetroArch nightly with Windows 10, using Amazon Echo as bluetooth speaker. As soon as you disconnect the bluetooth connection, RetroArch will crash.

ichee commented 2 years ago

This issue still occurs. Changed my TV input to watch some TV while playing and when I switched back, Retroarch was frozen. Using WASAPI audio driver. Windows 11