The first step in implementing the XACT audio project in your XNA project is to include the file you saved from XACT in your XNA project. Remember that previously you copied the .wav files to the AnimatedSpritesContent\Audio directory within your project, but you didn’t include those files in your XNA project through Visual Studio. As I mentioned earlier, the only file that you actually need to include in the XNA game project is the project file you created in XACT. Hopefully, you named the XACT project file GameAudio.xap and saved it in the project’s AnimatedSpritesContent\Audio directory. If so, add it to your project now by right-clicking the AnimatedSpritesContent\Audio folder in Solution Explorer, selecting Add→Existing Item, and browsing to your GameAudio.xap file.
To load the data from your XACT project file into objects that you
can use to play the sounds in XNA, you need to add the following
class-level variables at the top of your
AudioEngine audioEngine; WaveBank waveBank; SoundBank soundBank; Cue trackCue;
The first variable represents something called a sound
engine. This object will be used in the creation of your
SoundBank objects and is the core object used
for XNA sound. As you’ve probably already guessed, the
SoundBank objects will correspond to the sound
and wave bank sections of your XACT file. The
Cue object is used to pull out individual cues
from the sound bank to play those cues. You ...