public FileSound StartPlayingOnce(FileSound sound) { if (!Enabled) { return(null); } sound.Sound = soundEngine.Play2D(sound.SoundName); return(sound); }
private void BSound_Click(object sender, EventArgs e) { FileSound.ShowDialog(); if (!File.Exists(FileSound.FileName)) { return; } SaveSettings(); BSound.BackColor = CDEF; UpdateValueColor(); }
public void StopSound(FileSound sound) { if (sound.Sound != null) { sound.Sound.Stop(); if (music.Contains(sound)) { music.Remove(sound); } } }
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); }
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); }
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); }