I have to add sound to a game and I found that you can use xact. That's fine, however why not just use Content.Load?
Besides the tweaking of the sound, are there any other advantages to using Xact?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
There's a little more to game audio than just playing back and fading in/out sound files.
XACT is primarily useful when you're working with a sound designer who either has no coding experience, or no desire to work in code.
Omnion's answer covers the essentials:
Grouping sounds for selecting a sound to randomly play back
Grouping sounds for organizational purposes (maybe have multiple sounds with the same name but in different groups, so you just need to keep track of which group you're in
Easier control of realtime effects
Among the few (all small or indie) developers I've worked with, there's a bad habit when thinking about game audio to describe your audio needs exclusively in terms of asset lists. While you do need to eventually keep track of all the different sound files you need for a game, it's not useful at all in describing how multiple sound assets work together to create an overall sound event.
XACT and other tools like FMOD and Wwise create an interface between sound designer and programmer. The sound designer creates a Sound Cue, Event, or Sync (terminology depends on the tool being used) that can be referred to either by name (
const *char or
string) or by a GUI in a header or config file. This sound event contains multiple sound files that play back in a specific way that are controlled by parameters, which are usually variables associated with a sound event that control playback.
Here's Microsoft's article about parameters in XACT: http://msdn.microsoft.com/en-us/library/ee416028(v=vs.85).aspx
So the breakdown is this:
The classic example is a car engine. Here's a video someone made of their car engine model in FMOD. In this example the programmer would need to do the following:
I'm using FMOD on a project to control the movement of robots.
timeParam->keyOff();). Which basically just advances the time parameter to its end, as it does so, the whirring loop pitches down slightly while fading out to give the impression of the robot's motors slowing down.
XACT, FMOD, and Wwise are also really useful for footsteps, you can create a "Footstep" sound cue, which has a bank of different footsteps. It will select one at random, adjust its pitch randomly (within a limit).
The bottom line with these tools, is that your sound designer probably knows what sounds better than you do, so let them define the behavior in an abstract way, so then you only have to adjust some predefined parameters to get the desired effect.
Xact is a bit harder to use than the Content Pipeline method. It was originally the only way to play sounds, but the team added the Content Pipeline method for an easier way.
Xact lets you do stuff like:
Anyway, learning Xact can be a pain. Only do it if you really think your going to need it. Perhaps you could set up an abstraction in your game so you could switch to Xact a bit easier? If your going to have a lot of sounds and your going to want some of the above features, Xact might be the way to go. Personally, since your kind of new, I would just use the Content Pipeline method and switch to Xact if you really found the need for it later.