#define SUPERVISATER

#ifdef __cplusplus
extern "C" {
#endif

#include "sndlst2.h"

#undef DLL_IMPEXP
#ifdef _DLL_COMPILATION_MODE
	#define DLL_IMPEXP __declspec(dllexport)
#else
	#define DLL_IMPEXP
#endif

typedef struct dbgMICRO_DESCRIPTION_ *pdbgMICRO_DESCRIPTION;

SNDLST2_M_DynamicUseListOf(pdbgMICRO_DESCRIPTION);

typedef struct dbgMICRO_DESCRIPTION_{
	long	Id;
	long	sndId;
	MicroParam par;
	SNDLST2_M_DynamicElementDeclaration(pdbgMICRO_DESCRIPTION)
}dbgMICRO_DESCRIPTION;

typedef struct dbgLISTE_MICRO_{
	SNDLST2_M_DynamicAnchorDeclaration(pdbgMICRO_DESCRIPTION) pList;
}dbgLISTE_MICRO;


//-------stockage des associations
typedef struct dbgSND_tdstEvtStruct_ *pdbgSND_tdstEvtStruct;
SNDLST2_M_DynamicUseListOf(pdbgSND_tdstEvtStruct);

typedef struct dbgSND_tdstEvtStruct_
{
	SND_tduRefEvt evt;
	long asso;
	SNDLST2_M_DynamicElementDeclaration(pdbgSND_tdstEvtStruct)
} dbgSND_tdstEvtStruct;

/*																													*/

typedef struct dbgLISTE_EVT_{
	SNDLST2_M_DynamicAnchorDeclaration(pdbgSND_tdstEvtStruct) pList;
} dbgLISTE_EVT;

typedef struct dbgSND_tdstObjectStruct_ *pdbgSND_tdstObjectStruct;
SNDLST2_M_DynamicUseListOf(pdbgSND_tdstObjectStruct);

/*                                                           */
typedef struct dbgSND_tdstObjectStruct_
{
	//long asso;		//id de l'asso SOUND3D
	long indice;	//id de l'objet
	SoundParam par;
	dbgLISTE_EVT evts;
	SNDLST2_M_DynamicElementDeclaration(pdbgSND_tdstObjectStruct)
} dbgSND_tdstObjectStruct;

typedef struct dbgLISTE_OBJECT_{
	SNDLST2_M_DynamicAnchorDeclaration(pdbgSND_tdstObjectStruct) pList;
} dbgLISTE_OBJECT;

/***************** pour diversSND *****************************************/
//resource view-list
typedef struct dbgVOLUMELINE_DESCRIPTION_ *pdbgVOLUMELINE_DESCRIPTION;

SNDLST2_M_DynamicUseListOf(pdbgVOLUMELINE_DESCRIPTION);

typedef struct dbgVOLUMELINE_DESCRIPTION_{
	long	id;
	long	vol;
	SNDLST2_M_DynamicElementDeclaration(pdbgVOLUMELINE_DESCRIPTION)
}dbgVOLUMELINE_DESCRIPTION;


typedef struct dbgLISTE_VOLUMELINE_{
	SNDLST2_M_DynamicAnchorDeclaration(pdbgVOLUMELINE_DESCRIPTION) pList;
}dbgVOLUMELINE_MICRO;


/***************** pour VISUSND *****************************************/
typedef struct dbgVISUSND_ELEMENT_ *pdbgVISUSND_ELEMENT;

SNDLST2_M_DynamicUseListOf(pdbgVISUSND_ELEMENT);

typedef struct dbgVISUSND_ELEMENT_{
	long	id;
	tduRefRes res;
	SoundParam par;
	SNDLST2_M_DynamicElementDeclaration(pdbgVISUSND_ELEMENT)
}dbgVISUSND_ELEMENT;

typedef struct dbgVISUSND_LISTE_{
	SNDLST2_M_DynamicAnchorDeclaration(pdbgVISUSND_ELEMENT) pList;
}dbgVISUSND_LISTE;

#define TAILLE_HISTORIC 256

typedef struct {
//	u64 time;
	SND_tduRefEvt evt;
	long obj;
	long asso;
} historic_element;


//variables
extern dbgLISTE_MICRO dbg_micros;//liste des micros (utiliser pas SynchroSonore)
extern dbgLISTE_OBJECT dbg_objects;	  //description des associations courantes
extern dbgVISUSND_LISTE dbg_visusnd;
extern dbgVOLUMELINE_MICRO dbgVolumeLineSnd;
extern SndBool dbg_micros_init;
extern SndBool dbg_objects_init;
extern historic_element historic[TAILLE_HISTORIC];
extern int next_histo_element;

//fonctions générales
void SND_CALL SND_fn_vSetSupervisaterActive(SndBool active);
void SND_CALL SND_fn_vLaunchSupervisater(SND_tdstInitStruct *pInitStruct);
void SND_CALL SND_fn_vKillSupervisater();


//suivi des objets
void SND_CALL dbgSND_fn_vAddEventToObject(long indice,long type,long asso,SND_tduRefEvt evt);
void SND_CALL SND_CALL dbgSND_fn_vKillEventToObject(long indice,long asso);
void SND_CALL dbgSND_fn_vSetPosObject(long indice,SoundParam* par);

//suivi des micros
void SND_CALL dbgSND_fn_vAddMicro(long indice);
void SND_CALL dbgSND_fn_vKillMicro(long indice);
void SND_CALL dbgSND_fn_vSetPosMicro(long indice,MicroParam* par);

//historique des events
void SND_CALL dbgSND_fn_vAddHistoric(SND_tduRefEvt evt,long indice,long type_obj,long asso,tdstBlockResourceMem* res);
//ligne de volume
void SND_CALL dbgSND_fn_vKillVolumeLine(long line);
void SND_CALL dbgSND_fn_vAddVolumeLine(long line);
void SND_CALL dbgSND_fn_vSetVolumeLine(long line,long vol);

//bank
void SND_CALL dbgSND_LoadBank(int iId);
void SND_CALL dbgSND_UnLoadBank(int iId);

//sndvirt
//DLL_IMPEXP void SND_CALL dbgSND_fn_vRajListesSxdVirtual(virtual_voice_list* VV,audible_voice_list* VA,dead_voice_list* VD);
DLL_IMPEXP void SND_CALL dbgSND_fn_vRajListesSxdVirtual2(SND_tdhVirtualModule p_virtual_module);
DLL_IMPEXP void SND_CALL dbgSND_fn_vInitListesSxdVirtual(long p_virtual_module,char* descrpition);

//snd
DLL_IMPEXP void SND_CALL dbgSND_fn_vAddVoiceSample(long id,tduRefRes res,SampleParam *par);
DLL_IMPEXP void SND_CALL dbgSND_fn_vSetParVoiceSample(long id,SampleParam *par);
DLL_IMPEXP void SND_CALL dbgSND_fn_vDelVoiceSample(long id);

#ifdef __cplusplus
}
#endif

