XNA SoundEffect Class

Sometimes being a Windows Phone developer means being spoiled for choice. The XNA FCL contains various classes that you can harness in your XAML-based apps, and vice versa. One such class is the SoundEffect class, which is a lightweight class that allows you to specify an audio file and to play it from code without relying on, for example, the MediaElement control.

The SoundEffect class works well for short samples, where instant playback is required. SoundEffect provides support for controlling volume, panning, looping, and pitch of the audio, and even allows you to apply 3D audio effects. Be warned, however, that it is fussy about the format of the audio. I found that only PCM format wav files are supported. I recommend ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.