#ifdef M_SET_ALIGNMENT
#pragma pack(push)
#pragma pack(M_SET_ALIGNMENT)
#endif

#undef DLL_IMPEXP
#define DLL_IMPEXP __declspec(dllexport)

//sections et options du SND_CPA.INI
#define DX3D_SECTION "Directx3D Options"
#define DX3D_NBVOICES_KEY "Nb Voices"
#define DX3D_GUID_KEY "GUID for " 
#define DX3D_SPEAKERS_KEY "Speakers Configuration" 

//typedef publiques
typedef struct {
	SndBool bGuidNULL;
	GUID Guid;
	char description[128];
	char module[128];
	DSCAPS	caps;
} stGUIDAvailable;
typedef stGUIDAvailable* pstGUIDAvailable;

//--------------------------------------------------- SAMPLE DX3D
typedef struct _tdstSampleMemoryDX3D        tdstSampleMemoryDX3D;
typedef union _tduDataSampleDX3D tduDataSampleDX3D;
typedef struct _tdstTypeSampleMemDX3D tdstTypeSampleMemDX3D;
typedef union _tduRefResDX3D tduRefResDX3D;
typedef struct _tdstBlockResourceMemDX3D tdstBlockResourceMemDX3D;
typedef union _tduResMemDX3D tduResMemDX3D;

union _tduRefResDX3D {
        tdxId                       Id;
        tdstBlockResourceMemDX3D    *pstPtr;
} ;

//DANGER: 
//we must have sizeof(tdstBlockResourceMem)<sizeof(tdstBlockResourceMemDX3D)
//to avoid memory overflow after use of cast from tdstSampleMemory* to tdstSampleMemoryDX3D*

//parameters of a resource(sample) in memory
struct _tdstSampleMemoryDX3D {
        LPDIRECTSOUNDBUFFER		lpBufferLoop;
		char      *pcDataAttack;
		char      *pcDataLoop;

		long	  lSizeAttackBuff;
		long	  lSizeLoopBuff;
		unsigned char ucLoadedFlags;

        /*
        //LPDIRECTSOUNDBUFFER		lpBufferAttack;
        //LPDIRECTSOUND3DBUFFER		lpBufferAttack3D;
        //LPDIRECTSOUND3DBUFFER		lpBufferLoop3D;	
		   //extra data to avoid averflow
		   //when tdstSampleMemory* is cast into tdstSampleMemoryDX3D*
		tduSampleMemBuff *data;
		*/
}  ;

//union de la description du sample
union _tduDataSampleDX3D{
                tdstSampleMemoryDX3D    stMem ;
                tdstSampleStreaming     stStream ;
} ;

//paramètres d'une ressource sample (données en mem)
struct _tdstTypeSampleMemDX3D {
        SndBool             bPitchable;     //peut-on changer le pitch du sample
        SndBool             bVolable;       //peut-on changer son volume
        SndBool             bPanable;       //peut le paner
        SndBool             bSpacable;      //peut-on lui appliquer un effet space
        SndBool             bReverbable;    //peut-on (ou doit-on) le reverber
        SndBool             bStream;        //streming ou en mémoire
        SndBool             bLoop;          //loope-t-il
        tduDataSampleDX3D   uData;          //description du sample
        unsigned long		ulInc0 ;        //période en echantillons
        unsigned long       ulFreq;         //période en echantillons
        unsigned short      uwResolution;   //nb de bits (8 ou 16)
        unsigned short      uwNbChannels;   //nb de canaux(mono, stéreo ...)
        tdeTypeZip          eZip;
} ;

union _tduResMemDX3D {
                tdstTypeSampleMemDX3D   stSample ;
                tdstTypeMidiMem         stMidi ;
                tdstTypeCD              stCD;
                tdstTypeSequenceMem     stSequence ;
                tdstTypeSwitchMem       stSwitch ;
                tdstTypeSplitMem        stSplit;
                tdstTypeThemeMem        stTheme;
} ;

//description d'une ressource (données en mémoire)
struct _tdstBlockResourceMemDX3D {
        tdxId           Id;                     //id de la ressource
        tdeTypeResource eType;          //type
        tdeTypeStorage  eStorage;               //storage ???
        unsigned char   ucVolume;       //volume par dfaut
        SndBool         bIsLoaded ;     //TRUE si en méoire
        tduResMemDX3D   uRes ;          //description propre à la ressource
//        M_LstChildDeclaration(tdstBlockResourceMem,tdstSndPolyResource);        //insertion dans la liste ACP
        SNDLST2_M_StaticChildDeclaration(tdstBlockResourceMemDX3D*,tdstSndPolyResource*)        //insertion dans la liste ACP
};

#ifdef M_SET_ALIGNMENT
#pragma pack(pop)
#endif

DLL_IMPEXP int	SND_CALL SND_fn_iGetGUIDList(pstGUIDAvailable lpGuidDescrption,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetWantedGUID(char* GUID_wanted,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetCurrentGUID(char* description,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedGUID(char* wanted,char* selected,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentGUID(char* wanted,char* selected,int size);

DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bChangeCurrentSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bGetWantedSpeakerConfigurationSxdWave(DWORD *config,DWORD *geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bGetCurrentSpeakerConfigurationSxdWave(DWORD *config,DWORD *geometry);

DLL_IMPEXP SndBool SND_CALL SND_fn_bIsDirect3DOptimum();

//concerver pour compatibilité
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
