public void PlayCrossFade(string soundEffectName, TimeSpan duration, bool loopTrack = false) { if (!IsPlaying) { Play(soundEffectName, loopTrack); } else { CurrentSoundEffect.FadeOut(duration); CurrentSoundEffectName = soundEffectName; CurrentSoundEffect.Stop(); CurrentSoundEffect.PlayFadeIn(Volume, duration, loopTrack); } }
public void Play(string soundEffectName, float pitch, float pan, float volume, bool stopMusic, bool loopTrack = false) { if (IsMuted) { return; } if (IsPlaying) { Stop(); } CurrentSoundEffectName = Exceptions(soundEffectName); if (CurrentSoundEffect != null) { if (stopMusic) { MusicManager.Pause(CurrentSoundEffect.Duration); } CurrentSoundEffect.Play(pitch, pan, volume, loopTrack); } }
public void Update(GameTime gameTime) => CurrentSoundEffect?.Update(gameTime);
public void Stop() => CurrentSoundEffect?.Stop();
public void Pause() => CurrentSoundEffect?.Pause();
public void Resume() => CurrentSoundEffect?.Resume();
public void FadeOut(TimeSpan duration) => CurrentSoundEffect?.FadeOut(duration);