xWMA with XACT in XNA Game Studio 3.1

Wednesday, December 8, 2010
By: Jason Doucette

Problem:

If you are using XNA Game Studio 3.1, and attempting to use the much better (nearly 50% the size) xWMA compression rather than the standard XMA compression, then you will notice that Visual Studio will hang up during compilation. Checking the Windows Task Manager will show XactBld3.exe is stalled.  Ctrl+Alt+Del'ing this compilation of XACT will allow the build to continuing, but you will not have the audio built properly.  This issue has been resolved in XNA Game Studio 4.0, however many developers are still using XNA game Studio 3.1, since 4.0 offers a great many breaking changes.

Solution:

FlipperAnubi on the App Hub forums offers a solution.  Replace XactBld3.exe with our own program, that launches the original XactBld3.exe.  Our program will run in a console window, and the output from that program will flow harmlessly to the console window.  It is this output that apparently is causing the original XactBld3.exe to hang up Visual Studio.  The steps for this solution are as follows:

Step #1. Rename the original XactBld3.exe

Go into C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v3.1\Tools and rename XactBld3.exe to ORIGINAL_XactBld3.exe

Step #2. Create our own program to replace XactBld3.exe

Compile the following program, name is XactBld3.exe, and replace the original with it in C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v3.1\Tools.

using System;
using System.Diagnostics;
namespace XactBld3_Wrapper
{
 class XactBld3_Wrapper
 {
  static void Main(string[] args)
  {
   string argumentString = String.Empty;
   foreach (string argument in args)
   {
    if (argument.Contains(" "))
     argumentString = argumentString + "\"" + argument + "\" ";
    else
     argumentString = argumentString + argument + " ";
   }
   string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
   int index = path.LastIndexOf('\\');
   path = path.Substring(0, index + 1);
   Console.WriteLine("Attempting to execute XACT...");
   Process xactProcess = new Process();
   xactProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
   xactProcess.StartInfo.FileName = path + "ORIGINAL_XactBld3.exe";
   xactProcess.StartInfo.Arguments = argumentString;
   xactProcess.Start();
   xactProcess.WaitForExit();
  }
 }
}

Conclusion

Try compiling a build with XACT using xWMA now, and you should see your own program run in a console window with a ton of verbose output from XactBld3.exe, and this should no longer hang up Visual Studio. Enjoy the 2x compression rate over WMA (at least, in the default compression settings of 60).

 

 

About the Author: I am Jason Doucette of Xona Games, an award-winning indie game studio that I founded with my twin brother. We make intensified arcade-style retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $190,000 in contests. Our games have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, have won game contests, and have held 3 of the top 5 rated spots in Japan of all Xbox LIVE indie games. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions -- relating to the games we make. Read about our story, our awards, our games, and view our blog.