public static void unloadSound(ref ExtendedAudioBuffer sound) { if (sound == null) { return; } sound.stop(); sound.Dispose(); sound = null; }
/// <summary> /// Loads and plays the specified wave file, and disposes it after it is done playing. /// </summary> /// <param name="fn">The name of the file to play.</param> public static void playAndWait(String fn) { ExtendedAudioBuffer s = LoadSound(fn); PlaySound(s, true, false); while (isPlaying(s)) { Thread.Sleep(100); } s.Dispose(); s = null; }