コード例 #1
0
        public FileSound StartPlayingOnce(FileSound sound)
        {
            if (!Enabled)
            {
                return(null);
            }

            sound.Sound = soundEngine.Play2D(sound.SoundName);
            return(sound);
        }
コード例 #2
0
 private void BSound_Click(object sender, EventArgs e)
 {
     FileSound.ShowDialog();
     if (!File.Exists(FileSound.FileName))
     {
         return;
     }
     SaveSettings();
     BSound.BackColor = CDEF;
     UpdateValueColor();
 }
コード例 #3
0
 public void StopSound(FileSound sound)
 {
     if (sound.Sound != null)
     {
         sound.Sound.Stop();
         if (music.Contains(sound))
         {
             music.Remove(sound);
         }
     }
 }
コード例 #4
0
        public FileSound SoundByName(String soundName)
        {
            FileSound finded = sounds.Find(sound => sound.SoundName.Equals(soundName));

            if (finded == null)
            {
                throw new Exception("Sound with name " + soundName + " does not exists!");
            }

            return(finded);
        }
コード例 #5
0
        public FileSound StartPlayingForSpecifiedTime(FileSound sound, long howLong)
        {
            if (!Enabled)
            {
                return(null);
            }

            sound.Sound = soundEngine.Play2D(sound.SoundName, true);
            Timer timer = new Timer(howLong);

            timer.Elapsed += new ElapsedEventHandler((sender, e) => StopSound(sound));
            timer.Start();

            return(sound);
        }
コード例 #6
0
        public FileSound StartPlayingInfinite(FileSound sound)
        {
            if (!music.Contains(sound))
            {
                music.Add(sound);
            }

            if (!Enabled)
            {
                SetMusicVolume(0);
            }

            sound.Sound = musicEngine.Play2D(sound.SoundName, true);
            return(sound);
        }