public static void StopSound() { if (CurrentSoundCue != null) { CurrentSoundCue.Stop(AudioStopOptions.AsAuthored); CurrentSoundCue.Dispose(); CurrentSoundCue = null; } }
// Plays a new SOUND Cue. Stops old cue if there is one. public static void StartSoundCue(string cueName) { if (CurrentSoundCue != null && CurrentSoundCue.IsStopped) { CurrentSoundCue = null; } if (CurrentSoundCue != null) { if (GetPriorityFromCueName(cueName) > GetPriorityFromCueName(CurrentSoundCue.Name)) { StopSound(); CurrentSoundCue = Sounds.GetCue(cueName); CurrentSoundCue.Play(); } } else { CurrentSoundCue = Sounds.GetCue(cueName); CurrentSoundCue.Play(); } }