Editor becomes unresponsive if Default Audio Device changed

Changing the audio device in Windows (or unplugging / replugging in a Jack) causes the editor to become completely unresponsive.

This is easy to reproduce - in my case I just unplug an audio jack on the back of my PC and swap it over to another one (E.g., switching between headphones or speakers). When I do this, the editor locks up completely and I can’t interact with anything.

Nothing in the logs though, and Visual Studio still responds fine. This also occurs in Paragon.

Hello ,

I tried reproducing this but it doesn’t seem that it’s that simple. Just to be clear, when you say that it becomes “unresponsive” do you mean that the editor is freezing or that it’s no longer playing audio?

What OS are you using? There are some audio switching issues that are specific to different OS versions so this could be important.

There was some issues with how windows 10 and XAudio2 interacts with audio device swapping. In general, unfortunately, UE4 doesn’t currently support switching audio devices on the fly. However, I have recently checked in fixes (which are now in 4.13) that prevents crashing or locking up on windows 10 with audio device removal.

Hey Guys,

So when I do this, the Engine locks up completely. In fact if it’s minimized at the time, I can’t even bring it back up. I’ll try dropping in a breakpoint next time to see where it’s freezing.

You know the 6 audio ports you usually get on the back of the motherboard? I unplug my speaker jack from the Green one,then plug my headphones in instead. Doing so locks everything up.

If I do this in Paragon, the audio engine just stops working completely. Sometimes the game will freeze, but usually it just results in me having no sound.

I’m on Windows 10 using default audio drivers, so nothing special.

Just chiming in to say I’m having the same issue (Windows 10, 4.13)

Because I’m using my display’s audio device, when the display goes into sleep mode or I swap AV inputs the engine freezes and is unable to be brought back into focus. The window does not become “unresponsive” and the debugger continues as if nothing was wrong.

I’d be perfectly happy with losing audio and having to restart the editor when my audio device is reset, but having it lock up is a real bummer.

@Minus_Kelvin Is your fix in 4.13 now or coming in 4.13.1? Can you post the commit id as well? Thanks!

There were 2 separate fixes for the win10-only issue. The first is in 4.13 now and should fix the issue with unplugging headphones while UE4 is running (it won’t crash). The second fix related to win10 going asleep then unpluggin phones, and we found it right before 4.13 went out so the fixt didn’t make it into 4.13 and is likely not going to make it in a hot fix.

The change doesn’t look like it’s in our UE4/Main branch yet.

Out of interest, would swapping audio devices be supported in the near future? I realise this isn’t something games traditionally do since output is typically handled at the OS level for Windows at least via setting the Default Audio Device.

In my case I have regular desktop speakers and full-on studio monitors with a firewire interface, so being able to switch between on the fly would be super-rad.

Any update on this issue as we are still reproducing the issue in 4.15.1. Windows 10, as soon as a pair of headphones are unplugged the edtior freezes.

Hello Cort,

I’m not experiencing the same freezing issue that you are but please try launching the editor with the “-audiomixer” commandline argument. This command enables the experimental new audio engine. This could cause other issues due to being experimental but I’m curious if it will solve your issue.

I just got this crash on 4.18. Windows Mixed Reality devices seem to make their audio device go away when they idle out, and that appears to have caused things to crash for me in with a stack trace leading to xaudio2_7

Hello muchcharles, as mentioned below, can you try using the experimental audio engine by launching with the -audiomixer command to see if you continue seeing this issue with that enabled? I wouldn’t suggest developing with this new audio system, but it would be useful to know if it helps with this particular issue.

I’ve switched to the experimental audio engine for a while now and I still get the issue, but instead of a crash, it manifests as the editor freezing/hanging up.