Demonstrates how to specify sound (.WAV) files as background music. Specifying background music enables the XNA Framework to override the background music with the user’s music choice, without interrupting other game sounds such as sound effects. This is accomplished by setting the sound bank category to music in XACT.
Note |
---|
Streaming allows for the .WAV file to be gradually read from the disk rather than loaded into memory all at once. Background music files may be larger than files containing other game sounds; therefore, typically they are streamed. In XACT, you need to create and use a streaming WaveBank to stream background music. To learn about streaming, see How To: Stream a Sound. |
Specifying Background Music in Your Game
This procedure assumes you are have already created an XACT project.
To specify background music in your game
-
To open the XACT project, choose the File menu, and then click Open Project.
-
Browse to your project location, and click Open.
The project will load.
-
Double-click the sound bank that contains the background music.
This highlights the sound bank in the left navigation tree, and displays the sound bank properties pane.
-
Click the sound you wish to designate as background music.
This displays the properties pane, and then shows the category options for the sound.
-
Select music in the category drop down box, and save the project.