public static void Initialize(IServiceProvider service) { instance = new SoundManager(service, "Sounds", "soundEffect.xml"); }
public AmbientLoopSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.lastDistance = float.MaxValue; this.radius = radius; }
public AmbientSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.radius = radius; this.Probability = sfx.Probability; }
public Normal3DSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.radius = radius; }
public NormalSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx) : base(parent, sfx) { this.radius = 1; }
public SoundEffectGame(AudioListener listener, SoundManager sm, ConfigurationSection sect) { this.contentManager = sm.Content; this.listener = listener; string[] control = sect.GetStringArray("Control"); for (int i = 0; i < control.Length; i++) { control[i] = control[i].ToLowerInvariant(); switch (control[i]) { case "loop": Control |= SoundControl.Loop; break; case "random": Control |= SoundControl.Random; break; case "ambient": Control |= SoundControl.Ambient; break; } } Probability = sect.GetSingle("Probability", 1); Volume = sect.GetSingle("Volume", 1); Type = (SoundType)Enum.Parse(typeof(SoundType), sect.GetString("Type", SoundType.Normal.ToString()), true); //this.soundEffect = contentManager.Load<SoundEffect>(sect.Name); soundEffects = new SoundEffect[3][]; if ((Control & SoundControl.Loop) == SoundControl.Loop) { string[] fadein = sect.GetStringArray("Fadein"); soundEffects[(int)SoundEffectPart.Fadein] = new SoundEffect[fadein.Length]; for (int index = 0; index < fadein.Length; index++) { soundEffects[(int)SoundEffectPart.Fadein][0] = contentManager.Load<SoundEffect>(fadein[index]); } string[] mediumstring = sect.GetStringArray("Medium"); soundEffects[(int)SoundEffectPart.Medium] = new SoundEffect[mediumstring.Length]; for (int index = 0; index < mediumstring.Length; index++) { soundEffects[(int)SoundEffectPart.Medium][index] = contentManager.Load<SoundEffect>(mediumstring[index]); } string[] fadeout = sect.GetStringArray("Fadeout"); soundEffects[(int)SoundEffectPart.Fadeout] = new SoundEffect[fadeout.Length]; for (int index = 0; index < fadein.Length; index++) { soundEffects[(int)SoundEffectPart.Fadeout][0] = contentManager.Load<SoundEffect>(fadeout[index]); } } else { string[] sounds = sect.GetStringArray("Sounds"); soundEffects[(int)SoundEffectPart.Fadein] = new SoundEffect[sounds.Length]; for (int i = 0; i < sounds.Length; i++) { soundEffects[0][i] = contentManager.Load<SoundEffect>(sounds[i]); } soundEffects[1] = soundEffects[0]; soundEffects[2] = soundEffects[0]; } }