This project is read-only.

SoundEffectPlayer class

This class is used to play SoundEffect objects using the XNA integration. The player must live long enough for the sound effect to play so it is common to have it scoped outside a method. For example:

public partial class MediaPage : PhoneApplicationPage
  // ...

  SoundEffectPlayer _player = null;

  private void playButton_Click(object sender, RoutedEventArgs e)
    var resource = Application.GetResourceStream(new Uri("alert.wav", UriKind.Relative));
    var effect = SoundEffect.FromStream(resource.Stream);
    _player = new SoundEffectPlayer(effect);

Last edited Mar 5, 2011 at 8:55 AM by TheADOGuy, version 3


No comments yet.