package
{
	import flash.events.Event;
	import flash.media.Sound;
	import flash.media.SoundChannel;
	
	/**
	 * ...
	 * @author Michael Miriti
	 */
	public class Sounds
	{
		static private var _instance:Sounds;
		
		[Embed(source="../assets/snd/select.mp3")]
		private static var sndSelect_asset:Class;
		
		[Embed(source="../assets/snd/death.mp3")]
		private static var sndDeath_asset:Class;
		
		[Embed(source="../assets/snd/encore.32k.mp3")]
		private static var sndEncoreMusic_asset:Class;
		
		public var sndSelect:Sound = new sndSelect_asset();
		public var sndDeath:Sound = new sndDeath_asset();
		public var sndEncoreMusic:Sound = new sndEncoreMusic_asset();
		
		private var _musicLoopChan:SoundChannel;
		
		public function Sounds()
		{
			playMusic(null);
		}
		
		private function playMusic(e:Event):void
		{
			_musicLoopChan = sndEncoreMusic.play();
			_musicLoopChan.addEventListener(Event.SOUND_COMPLETE, playMusic);
		}
		
		public static function getI():Sounds
		{
			if (_instance == null)
				_instance = new Sounds();
			
			return _instance;
		}
	
	}

}