//---------------------------------------------------------------------------
#ifndef FxDefH
#define FxDefH
//---------------------------------------------------------------------------

#define MAX_FX_NUM		10
#define FX_ECHO   		0x00
#define FX_DISTORTION 	0x01
#define FX_ROTATE 		0x02
#define FX_REVERB	 	0x03
#define FX_COMPRESSOR 	0x04
#define FX_WAH	  		0x05
#define FX_CHORUS 		0x06
#define FX_PARAMEQ 		0x07
#define FX_PHASER 		0x08
#define FX_PITCH 		0x100
//#define FX_APR		 	0x101
//#define FX_VOLUME		0x102
#define FX_VST			0x10000

/***************************************************************************************/
// 全局结构定义
/***************************************************************************************/
#include <memory>
typedef struct tagAudioFx
{
	int iFx;
	int iPreset;//iPlugins
	WORD bBypass;
	WORD nParamSize;
	void* pParam;

	tagAudioFx( int iF, int iP, void* pP, int nSize, bool bB=false ){
		iFx = iF;
		iPreset = iP;
		nParamSize = nSize;
		pParam = pP;
		bBypass = bB;
	}

	tagAudioFx( tagAudioFx* pSrc ){
		memcpy( this, pSrc, sizeof(tagAudioFx) );

		if( pSrc->nParamSize ){
			pParam = new float[pSrc->nParamSize];
			memcpy( pParam, pSrc->pParam, sizeof(float)*nParamSize );
		}
	}

	~tagAudioFx(){
		if( pParam )
			delete[] pParam;
	}

} TAudioFx;

/***************************************************************************************/
// 全局常量
/***************************************************************************************/
extern const char		*g_strEffect[MAX_FX_NUM],
						*g_strEffectPreset[MAX_FX_NUM][3],
						*g_strEffectParamName[MAX_FX_NUM][6];
extern const DWORD		g_aAudioEffectTypes[MAX_FX_NUM]; //音效类型
extern const float		g_aEffectParamLimit[MAX_FX_NUM][6][2];//音效参数映射
/***************************************************************************************/
// 全局变量
/***************************************************************************************/
//extern PTEffect			g_aAudioEffects[MAX_FX_NUM],    //启用的音效
//						g_aAudioEffects_SVD[MAX_FX_NUM];//保存工程比较

/***************************************************************************************/
// 全局函数
/***************************************************************************************/
int GetFxPresetCount( int iFxType );
void GetFxPreset( int iFxType, int iPreset, float fParams[] );
int GetFxParamNum( int iFxType );
float Pos2Param( int iFx, int iParam, int Pos );
int Param2Pos( int iFx, int iParam, float fParam );

HRESULT AudioApplyEffect( int iWave, int ind, TAudioFx* pFx );
void AudioEffectsClear( int iWave, bool bApply=true );
void AudioEffectsDefault( int iWave, bool bApply=true );
void AudioEffectsSet( int iWave );

/*
void SetAudioEffects( bool bOn=true );
void ResetAudioEffects( int nLastBarNum=0 );
void SortAudioEffects( int iFx=-1 );
void ClearAudioEffects( TEffect** aEffects );
void MoveAudioEffects( int iStartBar, int iEndBar, int iInsertBar, int iMode );

void AudioEffectsDefault( int iWave, bool bApply=true );
void AudioEffectsClear( int iWave, bool bApply=true );
bool AudioEffectsSort( int iWave, int iFx=-1 );
void AudioEffectsSet( int iWave, bool bOn=true );
bool AudioEffectsMove( int iSrc, double dblStart, double dblEnd, int iDest, double dblInsert, int iMode );

void ClearAudioEffects( TEffect* lstDest[] );
void CopyAudioEffects( TEffect* lstDest[], TEffect* lstSrc[], double dblStart, double dblEnd );
void InsertAudioEffetcts( TEffect* lstDest[], TEffect* lstSrc[], double dblInsert, double dblLen );
void SortAudioEffects( TEffect** lstEffect );
void RemoveAudioEffects( TEffect* lstEffects[], double dblStart, double dblEnd );
TEffect* DuplicateEffects( TEffect* lstSrc );
*/
#endif
