public static SoundMusic LoadMusic(this ContentManager content, ONAF2.Level level, string path, float volume = 1.0f, bool looped = true) { SoundMusic res = content.Load <SoundMusic>(path); foreach (var kvp in level.VolumeController.Music) { if (kvp.Key == res) { content.Unload(res); return(kvp.Key); } } res.Volume = volume * level.Main.Volume; res.IsLooped = looped; level.VolumeController.Register(res, volume); return(res); }
public static SoundEffect LoadSoundEffect(this ContentManager content, ONAF2.Level level, string path, float volume = 1.0f, bool looped = false) { SoundEffect res = content.Load <SoundEffect>(path); foreach (KeyValuePair <SoundEffect, float> kvp in level.VolumeController.Effects) { if (kvp.Key == res) { content.Unload(res); return(kvp.Key); } } res.Volume = volume * level.Main.Volume; res.IsLooped = looped; level.VolumeController.Register(res, volume); return(res); }