/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__NMIXER__
#define	__NMIXER__


		#include "core/mixer_data.h"
		#include "memory/nauto_ptr.h"


namespace GS {
	namespace Audio {

/*!
	@short	Mixer interface.
	@author Emmanuel Julien (ejulien@gsworks.fr)
*/
struct	IMixer
{
enum	State
{
	Invalid	=	0,
	Stopped,
	Playing,
	Paused
};

enum	Loop
{
	None = 0,
	Repeat
};

/*!
	@name	Interface.
	The API any concrete mixer must implement.
	@{
*/
virtual	bool			Open() = 0;
virtual	void			Close() = 0;

virtual	void			SuspendWorkerThread() = 0;
virtual	void			ResumeWorkerThread() = 0;

virtual	void			SetMasterVolume(float = 1.0) = 0;
virtual	float			GetMasterVolume() = 0;

		/// Play a sound, does not wait for the worker thread return code.
virtual	bool			StartFast(int, FutureData *) = 0;
		/// Play a sound, returns the channel on which the stream was started.
virtual	int				Start(int, FutureData *) = 0;
		/// Start a stream, does not wait for the worker thread return code.
virtual	bool			StreamFast(int, const char *) = 0;
		/// Start a stream, returns the channel on which the stream was started.
virtual	int				Stream(int, const char *) = 0;
virtual	void			Stop(int) = 0;
virtual	void			Pause(int) = 0;
virtual	void			Resume(int) = 0;

virtual	int				LockChannel() = 0;
virtual	void			UnlockChannel(int) = 0;
virtual	void			UnlockAllChannels() = 0;

virtual	float			GetChannelPitch(int) = 0;
virtual	float			GetChannelVolume(int) = 0;
virtual	float			GetChannelPanning(int) = 0;
virtual	Loop			GetChannelLoopMode(int) = 0;
virtual	int				GetChannelLoopPosition(int) = 0;

virtual	void			SetChannelPitch(int, float) = 0;
virtual	void			SetChannelVolume(int, float) = 0;
virtual	void			SetChannelPanning(int, float) = 0;
virtual	void			SetChannelLoopMode(int, Loop = None) = 0;
virtual	void			SetChannelLoopPosition(int, int ms) = 0;

virtual	State			GetState(int) = 0;

virtual	FutureData		*LoadSound(const char *) = 0;
virtual	void			UnloadSound(FutureData *) = 0;
/// @}

virtual	~IMixer() {}
};

	} // Audio
} // GS


#endif	// __NMIXER__
