4

I am using the following code to play a wav file. I want the have the file play over and over until the user clicks a button. How might I do this?

Stream stream = TitleContainer.OpenStream("Audio/ape.wav");
        SoundEffect effect = SoundEffect.FromStream(stream);
        FrameworkDispatcher.Update();
        effect.Play();
Nick LaMarca
  • 8,076
  • 31
  • 93
  • 152

1 Answers1

2

use SoundEffectInstance.IsLooped for this. and SoundEffectInstance.Stop on button click.

Mubashir Khan
  • 1,464
  • 1
  • 12
  • 17