/// <summary> /// Garbage collection. /// </summary> protected override void Dispose(bool disposing) { try { if (disposing) { if (_MusicCue1 != null) { _MusicCue1.Dispose(); _MusicCue1 = null; } if (_MusicCue2 != null) { _MusicCue2.Dispose(); _MusicCue2 = null; } if (_SoundBank != null) { _SoundBank.Dispose(); _SoundBank = null; } if (_WaveBank != null) { _WaveBank.Dispose(); _WaveBank = null; } if (_AudioEngine != null) { _AudioEngine.Dispose(); _AudioEngine = null; } } } finally { base.Dispose(disposing); } }
/// <summary> /// Updates the AudioManager. /// </summary> public override void Update(GameTime gameTime) { _AudioEngine.Update(); if (_MusicCue1 != null) { _MusicCue1.Update(gameTime); //if musicCue1 is stopped, do this. if (_MusicCue1.IsStopped) { if (_AudioTransitionState == AudioTransitionStates.FadeOutFadeIn) _MusicCue2.Play(); _MusicCue1.Dispose(); _MusicCue1 = null; } //If musicCue2 is paused, play this one else if (!_MusicCue1.IsPlaying && _MusicCue2.IsPaused) { if (_AudioTransitionState == AudioTransitionStates.FadeOutFadeIn) _MusicCue1.Play(); } } if (_MusicCue2 != null) { _MusicCue2.Update(gameTime); //if musicCue2 is stopped, do this. if (_MusicCue2.IsStopped) { if (_AudioTransitionState == AudioTransitionStates.FadeOutFadeIn) _MusicCue1.Play(); _MusicCue2.Dispose(); _MusicCue2 = null; } //If musicCue1 is paused, play this one. else if (!_MusicCue2.IsPlaying && !_MusicCue2.IsStopped && _MusicCue1.IsPaused) { if (_AudioTransitionState == AudioTransitionStates.FadeOutFadeIn) _MusicCue2.Play(); } } base.Update(gameTime); }