I try to stop Cue and then play it again. This code is in the Update () loop:
Cue torpedoSound = soundBank.GetCue("torpedo"); torpedoSound.Stop(AudioStopOptions.AsAuthored); torpedoSound.Play();
However, I always get an InvalidOperationException in the above location. The documentation says this will happen if Play() is called on Cue , for which isPlaying true. But if I call Stop() right away, how can this be?
This works great:
soundBank.PlayCue("torpedo");
Placing a Stop() call right after that allows the sound to play anyway, which surprises me:
soundBank.PlayCue("torpedo"); torpedoSound.Stop(AudioStopOptions.Immediate);
Doesn't that make it never audible to the user?
In addition, when the sound is already playing, the Stop() call cannot be stopped.
I am new to C # / XNA.
source share