Playing Sounds from an XACT Project
This section demonstrates how to initialize the audio engine, to load sound banks and wave banks created using XACT, and then to play a sound by using a Cue object.
The code in this topic shows you the techniques for initializing, loading, and playing sounds. You can download a complete code sample for this topic, including full source code and any additional supporting files required by the sample.
Playing a Sound Using XACT
After you have an XACT project that has sound files, you then can load and play those sounds in your game. To add sound files to an XACT project, see Adding a Sound File (XACT).
To play a sound using sound files created by XACT
When following these steps and using the code provided, ensure your file names match those given in the example.
- Adding a Sound File (XACT)
- Demonstrates how to add wave (.wav) files to an XACT project that can be built and interpreted by an XNA Game Studio game to play audio.
- Pausing a Sound (XACT)
- Demonstrates how to initialize the audio engine; how to load a sound bank and wave bank; and how to play, pause, resume, and stop a sound (called a cue).
- Playing a Sound
- Demonstrates how to play a simple sound by using SoundEffect.
- AudioEngine Class
- Represents the audio engine. Applications use the methods of the audio engine to instantiate and manipulate core audio objects.
- Cue Class
- Defines methods for managing the playback of sounds.
- SoundBank Class
- Represents a sound bank, which is a collection of cues.
- WaveBank Class
- Represents a wave bank, which is a collection of wave files.