Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public MusicEffect(SoundReference sound)
 {
     Music          = sound.CreateInstance();
     Music.IsLooped = true;
 }