public bool PlayNext() { if (Sounds.Count == 0) { return(false); } KillLast(); var sound = Sounds[0]; Sounds.RemoveAt(0); Sounds.Insert(Sounds.Count + (new Random()).Next(1), sound); //put back at end, with a little bit of shuffle. if (IsMusic) { MusicInstance = new MP3Player(sound); Instance = MusicInstance; } else { if (!SFXCache.ContainsKey(sound)) { SFXCache[sound] = SoundEffect.FromStream(new XAFile(sound).DecompressedStream); } var sfx = SFXCache[sound]; Instance = new SFXDecor(sfx.CreateInstance()); } Instance.Volume = InstVolume * GetVolFactor(); if (!IsMusic && Pan != 0) { Instance.Pan = Pan; } Instance.Play(); return(true); }
public HITTVOn(uint id, HITVM vm, bool IDMode) { this.VM = vm; Station = ""; if (id == 5) { //loadloop. load direct sound... var sfx = Content.GameContent.Get.Audio.GetSFX(new Patch(0x00004f85)); if (sfx == null) { return; } SFXCache.Add("loadloop", sfx); Instance = new SFXDecor(sfx.CreateInstance()); Instance.Volume = GetVolFactor(); Instance.IsLooped = true; Instance.Play(); } else { var aud = Content.GameContent.Get.Audio; if (aud.MusicModes.TryGetValue((int)id, out Station)) { if (aud.StationPaths.ContainsKey(Station)) { LoadStation(CleanPath(aud.StationPaths[Station])); } } } }
private void KillLast() { if (Instance == null) { return; } if (IsMusic) { MusicInstance.Stop(); MusicInstance.Dispose(); } else { Instance.Stop(); Instance.Dispose(); } Instance = null; MusicInstance = null; }