using Microsoft.Xna.Framework.Audio; namespace MLEM.Extensions { /// /// A set of extensions for dealing with and /// public static class SoundExtensions { /// /// Creates a new from the given , allowing optional instance data to be supplied as part of the method call /// /// The sound effect to create an instance from /// The value to set the returned instance's to. Defaults to 1. /// The value to set the returned instance's to. Defaults to 0. /// The value to set the returned instance's to. Defaults to 0. /// The value to set the returned instance's to. Defaults to false. /// public static SoundEffectInstance CreateInstance(this SoundEffect effect, float volume = 1, float pitch = 0, float pan = 0, bool isLooped = false) { var instance = effect.CreateInstance(); instance.Volume = volume; instance.Pitch = pitch; instance.Pan = pan; instance.IsLooped = isLooped; return instance; } } }