This tutorial will show you how to do sound loops in XACT. Probably this would be the most useful for background music, but I'm sure you can find other uses for it as well. Before going through this tutorial, it would probably help to go through the tutorials that teach you the basics of playing sound in XNA using XACT (Using XACT and Playing Sound) if you haven't already.
XACT Sound Loops
Setting up a sound to loop repeatedly, or to loop forever, is not all that hard. Open up your project in XACT. In the Sound Bank window, select the sound that you want to repeat.
On the panel on the left side, you should see a control that looks like the image below:
In the 'Looping' group, type in either the number of times that you want the sound to repeat, or check the 'Infinite' box to make the sound play forever.
After you save your project again, you should now be able to run your game again and see that the desired sound will play repeatedly, once you start playing it.
We've now seen how to make a sound play repeatedly. For the next step, you might want to check out the tutorials about 3D Sound. Also, since XACT can only deal with .wav files, you might also want to take a look at the tutorial that demonstrates how you can play .wma and .mp3 files in XNA.
|Having problems with this tutorial? Try the troubleshooting page!|