///////////////////////////////////////////////////////////////////////////////
/// @file Channels.hpp
///
/// @brief Destiny Sound System Channel handling
///
/// @author paradoxnj
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Jan 2002
/// @author paradoxnj
/// @remarks Creation
///
///////////////////////////////////////////////////////////////////////////////

//Sound Systems 
#ifndef CHANNELS_H
#define CHANNELS_H

#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
//#include <dshow.h>
//#include "eax.h"
#include "DirectSound.hpp"

#include "deFileSystem.hpp"
#include "deResource.hpp"

class deSFXManager;
//class deChannel;

IdeResourceBase							*deSound_LoadWAV(const char *filename, IdeFile *filesystem, deBoolean isThreaded);
IdeResourceBase							*deSound_LoadOGG(const char *filename, IdeFile *filesystem, deBoolean isThreaded);

class deSFXManager
{
public:
	deSFXManager();
	virtual ~deSFXManager();

public:
	IDirectSoundBuffer8					*m_pBuffer;
	IDirectSoundFXGargle				*m_pGargle;
	IDirectSoundFXChorus				*m_pChorus;
	IDirectSoundFXFlanger				*m_pFlanger;
	IDirectSoundFXEcho					*m_pEcho;
	IDirectSoundFXDistortion			*m_pDistortion;
	IDirectSoundFXCompressor			*m_pCompressor;
	IDirectSoundFXParamEq				*m_pParamEq;
	IDirectSoundFXWavesReverb			*m_pReverb;

	DSFXGargle							m_GargleSettings;
	DSFXChorus							m_ChorusSettings;
	DSFXFlanger							m_FlangerSettings;
	DSFXEcho							m_EchoSettings;
	DSFXDistortion						m_DistortionSettings;
	DSFXCompressor						m_CompressorSettings;
	DSFXParamEq							m_ParamEqSettings;
	DSFXWavesReverb						m_ReverbSettings;
	
	DSEFFECTDESC						m_EffectDesc[DESFX_ENUM];
	const GUID							*m_RefID[DESFX_ENUM];
	LPVOID								*m_pIntPtr[DESFX_ENUM];

	DWORD								m_NumEffects;
	DWORD								m_NumActiveBufs;

public:
	deBoolean							Initialize(IDirectSoundBuffer *buffer);
	void								Destroy();

	void								GetGargleSettings(deSFX_Gargle *gargle);
	void								GetChorusSettings(deSFX_Chorus *chorus);
	void								GetFlangerSettings(deSFX_Flanger *flanger);
	void								GetEchoSettings(deSFX_Echo *echo);
	void								GetDistortionSettings(deSFX_Distortion *distortion);
	void								GetCompressorSettings(deSFX_Compressor *compressor);
	void								GetParamEqSettings(deSFX_ParamEQ *param_eq);
	void								GetReverbSettings(deSFX_Reverb *reverb);

	void								SetGargleSettings(deSFX_Gargle *gargle);
	void								SetChorusSettings(deSFX_Chorus *chorus);
	void								SetFlangerSettings(deSFX_Flanger *flanger);
	void								SetEchoSettings(deSFX_Echo *echo);
	void								SetDistortionSettings(deSFX_Distortion *distortion);
	void								SetCompressorSettings(deSFX_Compressor *compressor);
	void								SetParamEqSettings(deSFX_ParamEQ *param_eq);
	void								SetReverbSettings(deSFX_Reverb *reverb);

	deBoolean							ActivateFX();
	deBoolean							EnableFX(deSFX_Type type);
	deBoolean							DisableFX();

	deBoolean							Play(deBoolean loop = deFALSE);
	deBoolean							IsPlaying();
	void								Stop();

	void								SetVolume(float vol);

};

#endif

