XAudio2 Dolby Digital Live patcher

For many years a bug has remained in XAudio2 library, that will make XAudio 2 report stereo channels to games using the API, even though output is 5.1.

This will make sound cards with DDL encoding output stereo instead of nice surround-sound. I found that this was still an issue, even with a fully updated system. You can see more about it in these threads: [1], [2]

This is an example of how it detects in Serious Sam 3:

23:18:32 INF: Sfx API: XAudio2
23:18:32 INF: Device: SPDIF Out (Xonar U7)
23:18:32 INF: Mixer frequency: 48000 Hz
23:18:32 INF: Mixer voices: 2
23:18:32 INF: Max sound sources: 30
23:18:32 INF: Max total volume: 3
23:18:32 INF: Speaker config: stereo
23:18:32 INF: Environment FX: enabled
23:18:32 INF: Current environment: Padded cell

The most common solution is to manually patch the dll files. Not a good solution, but since Microsoft hasn’t fixed this issue in over 5 years, I am not holding my breath.

I have created a small utility to help patch the dll files. You can download it here: XAudioPatch binary and here is the Source Code.

Step by step instructions:

  1. Be sure what you are doing. You are modifying binary DLL files. Be sure to back up files on every step. This has only been tested on my own Windows 7 machine. Other systems may work differently. Everything after this is at your own risk.
  2. Locate all files called XAudio2_?.DLL in your Windows/System32 folder. On my system there was 7 DLL files.
  3. Copy these files to a new folder.
  4. Copy them again as a backup.
  5. Download the xaudiopatch.zip and unzip it into the same folder.
  6. Drag the  XAudio2_0.DLL and similar files ON TO xaudiopatch.exe (Windows will show “Open with xaudiopatch.exe” or similar)
  7. If everything is all right, you now have ‘patched-XAudio2_0.dll’, etc. Move these files to a new folder and rename them to their original name.
  8. Replace the files in your system32 folder.

You can also use a commandline interface to do this. the syntax is simply “xaudiopatch file1.dll file2.dll”, etc. If you are unsure about any of the steps, you probably shouldn’t do it, since modifying system DLL files can be risky. You can look into using Virtual Audio Cables instead: Here is a guide.

You can test your XAudio 2 surround output with this utility.

Here is the output after patching the dll files.

00:33:48 INF: Sfx API: XAudio2
00:33:48 INF: Device: SPDIF Out (Xonar U7)
00:33:48 INF: Mixer frequency: 48000 Hz
00:33:48 INF: Mixer voices: 6
00:33:48 INF: Max sound sources: 35
00:33:48 INF: Max total volume: 3
00:33:48 INF: Speaker config: 5.1 (surround with subwoofer)
00:33:48 INF: Environment FX: enabled
00:33:48 INF: Current environment: Padded cell

 

This should give you surround sound on Dolby Digital Live on Realtek, Asus and other soundcards that have this feature, but where games only produce stereo output.