title: How to check if sound effect is playing (Looping a BG Song)
body: <p>Here is the setup I am rolling at the moment. Given this, how can I tell when the _BGMusic SoundEfect is over? I am running a game loop that cycles a few times a second and I ultimately want to loop this song. </p>
  
  <pre><code>using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Audio;
  
      SoundEffect _BGMUSIC;
  
      public Page1() {
       ...
  
       LoadSound("sfx/piano.wav", out _BGMUSIC);
       ...
      }
  
      private void LoadSound(String SoundFilePath, out SoundEffect Sound) {
          // For error checking, assume we'll fail to load the file.
          Sound = null;
          try {
              // Holds informations about a file stream.
              StreamResourceInfo SoundFileInfo =
                      App.GetResourceStream(new Uri(SoundFilePath, UriKind.Relative));
              // Create the SoundEffect from the Stream
              Sound = SoundEffect.FromStream(SoundFileInfo.Stream);
              FrameworkDispatcher.Update();
          } catch (NullReferenceException) {
              // Display an error message
              MessageBox.Show("Couldn't load sound " + SoundFilePath);
          }
      }
  </code></pre>