private SoundEffect LoadSound(string filename) { if (SoundCache.ContainsKey(filename)) return SoundCache[filename]; byte[] data = new XAFile(BaseDir+filename).DecompressedData; var stream = new MemoryStream(data); var sfx = SoundEffect.FromStream(stream); stream.Close(); SoundCache.Add(filename, sfx); return sfx; }
public AmbiencePlayer(Ambience amb) { if (amb.Loop) { byte[] data = new XAFile(TSO.Content.Content.Get().GetPath(amb.Path)).DecompressedData; var stream = new MemoryStream(data); sfx = SoundEffect.FromStream(stream); stream.Close(); inst = sfx.CreateInstance(); inst.IsLooped = true; inst.Play(); fscMode = false; } else { fsc = HITVM.Get().PlayFSC(TSO.Content.Content.Get().GetPath(amb.Path)); fsc.SetVolume(0.33f); //may need tweaking fscMode = true; } }