Xbox LIVE Indie Games
Sort Discussions: Previous Discussion Next Discussion
Page 1 of 1 (3 posts)


Last post 3/10/2011 2:26 PM by Martin Caine. 2 replies.
  • 3/2/2011 3:28 PM

    XACT Without XACT

    Don't you just hate XACT? It has an amazing GUI and is so powerful, but it was just not designed to run on a managed code environment. Setting variables creates garbage, cues create garbage, and the performance is rubbish when you start playing heaps and heaps of sounds. But none of these problems affect the SoundEffect API, even when XACT was crying like a miserable little girl from all the sounds I asked it to play SoundEffect API was playing just as many sounds with no issues what so ever (even with limit instances set aggressively small in XACT).

    I like RPC Presets in XACT, but using XACT for those sounds ruined performance. Solution? Use the RPC Presets with SoundEffect of course! Working all day with a math student friend of mine I reverse engineered all the 'Curve' functions in XACT so you can use the point information from the XACT RPC Curve editor GUI directly and drop them straight into your code and recreate that curve exactly. You could also rip the values out of the .xap (XACT project) file, they're the same values.

    This also had a second problem. How did the decibel values (-96db to 6db) for volume in XACT correspond to the SoundEffectInstance.Volume values (0 to 1) ? It took me 4 hours but I managed to reverse engineer that equation as well. I also did a function for converting from XACT pitch to SoundEffectInstance.Pitch, but that was fairly simple.

    All this code can be found here, all commented and with instructions for use:  Do whatever you want with it, just don't claim you were the one who worked it out :D

    In my audio code I use XACT for more complex sounds that need it and SoundEffect for the sounds that are played very frequently, avoiding the performance hit! I did however notice that Cue.Apply3D and SoundEffectInstance.Apply3D don't work together on Xbox (it's fine on PC), with SoundEffectInstance.Apply3D causing all the XACT sounds to mute while it was playing, then unmute when it was stopped. But you can hack around that with SoundEffectInstance.Pan.

    If you're feeling hardcore, have a look at this: it's a parser someone wrote for the .xap project file (which is plain text, making parsing reasonably straight forward). Combined with those functions, you could use the .xap project file in your Content Pipeline and load in all the settings and simulate XACT in code, but use SoundEffect for actual sound playing. XACT will always have an edge on SoundEffect, with its multiple compression settings and DSP Reverb Effect thing, but in many cases you can get away without those. I'd do it myself, but I have a DreamBuildPlay game to develop!

  • 3/6/2011 4:25 AM In reply to

    Re: XACT Without XACT

    This is great!  I've been looking into using XACT for the game I'm working on because I'll need well over 300 sounds for the final build (for which I plan to use the pitch and other effects in XACT to accomplish), but was always worried about performance.  I will have time to add some things eventually, since I won't be able to enter DBP this year :( . 

    So do you recommend actually putting the curve values into the code, or parsing the files with xapparse?
  • 3/10/2011 2:26 PM In reply to

    Re: XACT Without XACT

    I completely dropped XACT for our games after realising almost all of what we want to do can be done with the inbuilt sound APIs, and it would've been a pain to have two audio engines, XACT for 360/PC and soundeffect for WP7.

    I do like some of the cool things you can do easily with XACT but as you say using SoundEffect instances and a little custom class you can easily code some of the same effects yourself.
Page 1 of 1 (3 posts) Previous Discussion Next Discussion