using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;

namespace AdvancedXNAGamesWP
{
	public static class AudioManager
	{
		// the different fx that can be played
		public enum Cue
		{
			EnemyShot,
			PlayerShot,
			Explosion
		};

		// instances of the effects
		private static SoundEffect _theme;
		private static SoundEffect _enemyShot;
		private	static SoundEffect _playerShot;
		private static SoundEffect _explosion;

		private static SoundEffectInstance _themeInstance;

		public static void Load(ContentManager content)
		{
			// load 'em up
			_theme = content.Load<SoundEffect>("sfx\\theme");
			_themeInstance = _theme.CreateInstance();
			_enemyShot = content.Load<SoundEffect>("sfx\\enemyShot");
			_playerShot = content.Load<SoundEffect>("sfx\\playerShot");
			_explosion = content.Load<SoundEffect>("sfx\\explosion");
		}

		public static void PlayCue(Cue cue)
		{
			// play the effect requested
			switch(cue)
			{
				case Cue.EnemyShot:
					_enemyShot.Play();
					break;
				case Cue.PlayerShot:
					_playerShot.Play();
					break;
				case Cue.Explosion:
					_explosion.Play();
					break;
			}
		}

		public static void StartTheme()
		{
			_themeInstance.Play();
		}

		public static void StopTheme()
		{
			_themeInstance.Stop();
		}
	}
}
