/*********************************************************\
		 __      __           __  __
		/ /     / / _____    / / / / ______   __     __
	   / /     / / /___  \  / / / / / ___  | / /    / /
	  / /_____/ / _____| / / / / / / /__/ / / /    / /
	 / ______  / / ___  / / / / / / _____/ / /    / /
	/ /     / / / /__/ / / / / / / |____  / |____/ /
   /_/     /_/ |______/ /_/ /_/  \_____/  \_____  /
										 ______/ /
			High Level Game Framework   /_______/

  ------------------------------------------------------

  Copyright (c) 2008 - Rodrigo Braz Monteiro.
  This file is subject to the terms of license.txt.

\*********************************************************/

#pragma once

#include "halleystring.h"

namespace Halley {
	class AudioChannel {
	public:
		AudioChannel() : playing(false) {}
		bool playing;
	};

	class Audio {
	public:
		static shared_ptr<Audio> get();
		~Audio();

		void play(String name, float pan=0.5f, float volume=1.0f);
		void onChannelFinished(int n);
		void playMusic(String name, int loops=-1);
		void stopMusic();

	private:
		Audio();

		void setNumChannels(int n);
		int allocateChannel();

		std::vector<AudioChannel> channels;
		static shared_ptr<Audio> instance;
	};
}
