Before we start
There are several ways to play sounds or music in XNA. The SoundEffect
and SoundEffectInstance
classes enable us to do just that. XACT, Microsoft cross platform audio creation tool, is not supported on Windows Phone. However, there is still a lot we can do with the classes that are provided from the XNA framework, such as playing sounds, playing 3D sounds adjusting volume, pitch, and so on. There is no real limit on how many sounds you can load, except memory of the device of course. There is however a limit on how many sounds you can play simultaneously, that is 64. If we try to play more than 64 sounds at once, we will get an exception.
Let's start by playing some sounds! The sounds we will use in the demos come from flashkit.com and are freeware.