protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { if (currentSound != null) { currentSound.Dispose(); currentSound = null; } if (musicLst != null) { musicLst.Clear(); } } disposed = true; }
public void Update(float timeSinceLastFrame) { if (musicPlayQueue.Count == 0) { return; } GameSound sound = musicPlayQueue.Peek(); if (currentSound != null && currentSound.PlayStatus == SoundStatus.Playing) { return; } if (currentSound == null || currentSound.ID != sound.ID) //Not the same sound or music { currentSound = sound; currentSound.Play(PlayMode.Random); musicPlayQueue.Dequeue(); } currentSound.Update(); }
private string findMusicFileByID(string musicID) { string musicfile = string.Empty; var result = from musicDfn in modData.MusicInfos where musicDfn.ID == musicID select musicDfn; if (result.Count() == 1) { if (CurrentSound != null) { CurrentSound.Stop(); } currentSound = new GameSound(); if (result.First().Type == Mods.XML.TrackType.EngineTrack) { musicfile = string.Format("{0}//{1}//{2}", Environment.CurrentDirectory, modData.MusicDir, result.First().File); } else if (result.First().Type == Mods.XML.TrackType.ModuleTrack) { musicfile = string.Format("{0}//{1}//{2}", modData.BasicInfo.InstallPath, modData.MusicDir, result.First().File); } if (File.Exists(musicfile)) { return(musicfile); } else { return(null); } } else { return(null); } }
public SoundManager() { musicLst = new List <GameSound>(); currentSound = null; entities = new List <SoundEntity>(); }