Share via


SoundPlayer in the .NET Compact Framework

The .NET Compact Framework version 3.5 supports the SoundPlayer class, which provides an intuitive API for playing sounds in applications such as casual games. To enable casual game development, the .NET Compact Framework pushes each SoundPlayer object through WaveOut, which is the audio rendering filter in Windows Embedded CE and Windows Mobile powered devices. This filter enables the device to mix sounds.

The .NET Compact Framework 3.5 supports the following types:

For a code example that demonstrates how to use this feature, see SoundPlayer.

The differences between the .NET Compact Framework implementation and the desktop implementation of SoundPlayer include the following:

  • The .NET Compact Framework supports only PCM-encoded files (uncompressed sound).

  • On a device, more than one sound can play at the same time. On the desktop, only the last sound plays.

  • On a device, the application will not terminate until playback is completed. If a sound is playing in the application loop, the application will never exit. To avoid this situation, you can explicitly terminate playback by calling the Stop or Dispose method on the SoundPlayer object.

See Also

Other Resources

Building Applications and Core Tasks in the .NET Compact Framework