public static SoundReference AddSound(string filename) { if (Sounds.ContainsKey(filename)) { return(Sounds[filename]); } var rval = new SoundReference(filename); Sounds.Add(filename, rval); AllSounds.Add(rval); Load(rval); return(rval); }
private static void Load(SoundReference reference) { FileInfo fileinfo = new FileInfo(reference.FileName); if (fileinfo == null || !fileinfo.Exists) { return; } FileStream stream = fileinfo.OpenRead(); reference.Sound = SoundEffect.FromStream(stream); stream.Close(); }
public MusicEffect(SoundReference sound) { Music = sound.CreateInstance(); Music.IsLooped = true; }