// Plays the sound. public SoundInstance Play(bool looped, float volume, float pitch = 0.0f, float pan = 0.0f, bool muted = false) { SoundInstance soundInstance = new SoundInstance(soundEffect.CreateInstance(), this, looped, volume, pitch, pan, muted); soundInstance.Play(); sounds.Add(soundInstance); RemoveExtraInstances(); return soundInstance; }
/** <summary> Plays the sound. </summary> */ public SoundInstance Play(bool looped, float volume, float pitch = 0.0f, float pan = 0.0f, bool muted = false) { SoundInstance soundInstance = new SoundInstance(soundEffect.CreateInstance(), this, looped, volume, pitch, pan, muted); soundInstance.Play(); sounds.Add(soundInstance); if (sounds.Count > 8) { if (!sounds[0].IsStopped) sounds[0].Stop(); sounds.RemoveAt(0); } return soundInstance; }