How to Fix Deadlocks During Audio Device Swap in UE 4.24 and Earlier

Feb 26, 2021.Knowledge
Article written by Anna L.

There is a known issue in UE 4.24 as well as prior versions that leads to a deadlock when switching between different audio devices due to a limitation in the lowlevel API XAudio2.7. If your program freezes or has unreasonably long delays when doing things like switching between headphones and speakers, this may be what’s happening. This was fixed in later versions by upgrading to XAudio2.9 in 4.25 and beyond. However, it can be impractical to sync to an entirely new UE build while a project is already in development. As such, this document contains the specific changes needed to obtain XAudio2.9.

The primary change needed to upgrade to XAudio2.9 can be found in this GitHub CL. There were also a few subsequent bug fixes which can be found at these GitHub links as well. In addition, you may also need to regenerate your project files. You can tell if your project files were generated correctly by verifying that you see a file titled xaudio2_redist.dll in the path Engine/Source/ThirdParty/Windows/XAudio2_9/Bin/x64/.