diff --git a/MLEM/Extensions/SoundExtensions.cs b/MLEM/Extensions/SoundExtensions.cs
new file mode 100644
index 0000000..88d14f2
--- /dev/null
+++ b/MLEM/Extensions/SoundExtensions.cs
@@ -0,0 +1,28 @@
+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;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/MLEM/Misc/SoundEffectInfo.cs b/MLEM/Misc/SoundEffectInfo.cs
index 4ec3632..bffca93 100644
--- a/MLEM/Misc/SoundEffectInfo.cs
+++ b/MLEM/Misc/SoundEffectInfo.cs
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Audio;
+using MLEM.Extensions;
namespace MLEM.Misc {
///
@@ -49,13 +50,10 @@ namespace MLEM.Misc {
///
/// Creates a new with this sound effect info's data.
///
+ /// The value to set the returned instance's to. Defaults to false.
/// A new sound effect instance, with this info's data applied
- public SoundEffectInstance CreateInstance() {
- var instance = this.Sound.CreateInstance();
- instance.Volume = this.Volume;
- instance.Pitch = this.Pitch;
- instance.Pan = this.Pan;
- return instance;
+ public SoundEffectInstance CreateInstance(bool isLooped = false) {
+ return this.Sound.CreateInstance(this.Volume, this.Pitch, this.Pan, isLooped);
}
}