#include "SNDinc.H"

#include <windows.h>
#include <stdio.h>
#include <process.h> 

#include "sndres.h"

#if !defined(SNDDLL_MODULE) && defined(_DLL_COMPILATION_MODE)
//variable habituellement définie par SNDPLAY
tduRefRes SND_RES_FANTOME={(unsigned long)SND_C_RES_FANTOME_PTR};
#endif

#define INCLUDE_FROM_SNDDLL_C
#include  "SNDDLL.h"


HMODULE SND_hWavModule=NULL;
HMODULE SND_hCdModule=NULL;
HMODULE SND_hMpegModule=NULL;
HMODULE SND_hDbgModule=NULL;
HMODULE SND_hAdpcmModule=NULL;
HMODULE SND_hRecordModule=NULL;

char SNDDLL_g_DateVersion[]=__DATE__"-"__TIME__;
char SNDDLL_g_LabelVersion[]=
#include "SND/version.txt"
;


//  Surclasser le lecteur de CD ---> _SUBCLASSCDPLAYER
//  Cette methode utilise la DLL PMRstSub.Dll, d'ou l'include de librairie associe
//
//  #define _SUBCLASSCDPLAYER
/*
#ifdef _SUBCLASSCDPLAYER
#include "c:\AdvWin32\DLLCDPLAYER\AdvWin32.H"    
#pragma warning(disable: 4001)    
#define DLLCLIENT
#include "c:\AdvWin32\DLLCDPLAYER\PMRstSub.H"

#define LIBNAME   "c:\\AdvWin32\\DLLCDPLAYER\\PMRstSub\\Debug\\PMRstSub"
#pragma comment(lib, LIBNAME)

HINSTANCE SND_g_hinstDll;

#endif
*/

FARPROC _GetProcAddress(HMODULE module,char* name)
{
	FARPROC tmp;
	char texte[256],texte2[256];
	DWORD ret;

	if (!(tmp=GetProcAddress(module,name)))
	{
		ret=GetModuleFileName(module,texte,sizeof(texte));
		sprintf(texte2,"Function cannot be loaded dynamically:\n%.20s\nfrom module %.80s",name,texte);
		SND_fn_vDisplayError(E_uwSndSystemError,texte2);
		//DebugBreak(); DebugBreak will produce an unhandled execption if Debug mode is used
	}
	return tmp;
}


BOOL bStaticFunctions_Loaded = FALSE;
BOOL bMpegFunctions_Loaded = FALSE;
BOOL bWavFunctions_Loaded = FALSE;
BOOL bCdFunctions_Loaded = FALSE;
BOOL bDbgFunctions_Loaded = FALSE;
BOOL bAdpcmFunctions_Loaded = FALSE;
BOOL bRecordFunctions_Loaded = FALSE;

#ifdef USE_STATIC_MODULE
//-----------------------------------------------------------
//	SND_DllEntryPoints_StaticFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_StaticFunctions(HMODULE hDLLModule)
{
	if (bStaticFunctions_Loaded)
		return;

//Module SndERR.H
  SND_DLL_GetProcAddress(SND_fn_vDisplayError,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vDisplayErrorEx,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_iErreurInit,hDLLModule);
  SND_DLL_GetProcAddress(_snd_assert,hDLLModule);
  SND_DLL_GetProcAddress(snd_erreur_init,hDLLModule);

//HMODULEs
  SND_DLL_GetProcAddress(SND_fn_vGetHModuleMpeg,hDLLModule);
  SND_hMpegModule=SND_fn_vGetHModuleMpeg();
  SND_DLL_GetProcAddress(SND_fn_vGetHModuleWav,hDLLModule);
  SND_hWavModule=SND_fn_vGetHModuleWav();
  SND_DLL_GetProcAddress(SND_fn_vGetHModuleCd,hDLLModule);
  SND_hCdModule=SND_fn_vGetHModuleCd();
  SND_DLL_GetProcAddress(SND_fn_vGetHModuleAdpcm,hDLLModule);
  SND_hAdpcmModule=SND_fn_vGetHModuleAdpcm();
  SND_DLL_GetProcAddress(SND_fn_vGetHModuleRecord,hDLLModule);
  SND_hRecordModule=SND_fn_vGetHModuleRecord();

#ifdef DBGDLL_MODULE
//Fonctions de débogage
	SND_DLL_GetProcAddress(dbgSND_fn_bGetAskedTheme,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_bGetThemePosition,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vGetInfoForObjectSound,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_lGetSizeOfSoundParam,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetResNameCallback,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_czGetResNameFromEdId,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_bSetResourceStaticVolume,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_rGetDopplerFactor,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSendRequestSound,hDLLModule);
#endif

// Module Sndmem.h
  SND_DLL_GetProcAddress(SND_fn_vInitMallocSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vDesInitMallocSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_pvMallocSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_pvReAllocSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vFreeSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_pvMallocSndEx,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_pvReAllocSndEx,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vFreeSndEx,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vResizeMemoryBlockSnd,hDLLModule);

// Module Sndfile.h
  SND_DLL_GetProcAddress(SND_fn_bLoadDataInMem,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_bLoadDataInMemAndSwap,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_bSetCurrentDirectory,hDLLModule);

  SND_DLL_GetProcAddress(SND_fn_dwFileSndLength,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_dwWriteFileSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vAddDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vRemoveDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vPurgeDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_bGetOneDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_iGetNumberOfDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_iGetIdDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_bIsDataDirectory,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vResolveFileName,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_dwReadFileSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_dwSeekFileSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_hOpenFileReadSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vCloseFileSnd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetSoftDirectory,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_szGetSoftDirectory,hDLLModule);

  //sndini
	SND_DLL_GetProcAddress(SND_fn_bCanSetOptions,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bGetOptions,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetOptions,hDLLModule);

//module SNDldbin
	SND_DLL_GetProcAddress(SND_fn_iGetNumberOfBanks,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_iGetNumberOfEventInBank,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bStartLoadBanks,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bStartLoadBanks2,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bInitBank,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bInitBank2,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bEndLoadBanks,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_pGetBinEvent,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_pGetBinRes,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadBinaryBank,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bUnLoadBinaryBank,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vInitBankSnd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitBankSnd,hDLLModule);

// Module Sndspace.h
  SND_DLL_GetProcAddress(SND_fn_ucPositionToDolby,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_ucDistanceToVolume,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_ucDistanceToVolumeEx,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rDopplerPitch,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_ucPositionToPan,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOff,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vGetDefaultRollOff,hDLLModule);
                 
// Module SndReal.h
  SND_DLL_GetProcAddress(SND_fn_rMulRealRealSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rMulRealRealQuickSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rDivRealRealSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rAbsRealSnd,hDLLModule);

// Module SndVect.h
  SND_DLL_GetProcAddress(SND_fn_rNormeVectorSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rPseudoNormeVectorSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rScalaireVectorSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_rPseudoScalaireNormeVectorSnd,hDLLModule);
  SND_DLL_GetProcAddress(SND_fn_vProduitVectorSnd,hDLLModule);

// Module SndThrd.h
	SND_DLL_GetProcAddress(SND_fn_vInitThreadSnd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitThreadSnd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vEnterCriticalSectionThreadSnd_,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vQuitCriticalSectionThreadSnd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vMouchardThreadsnd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vWaitForValueThreadSnd,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vStartCallbackThreadsnd,hDLLModule)

//Module SndTest.h
	#ifndef SPEEDBUSTER
	SND_DLL_GetProcAddress(SND_fn_bTestSnd_Pentium,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestSnd_MMX,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestSnd_WinMM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestSnd_WinNT,hDLLModule);
	#endif

	//appeler après GetProcAddress(DisplayError) car risque d'erreur
  SND_DLL_GetProcAddress(SND_fn_vGetHModuleDbg,hDLLModule);
  SND_hDbgModule=SND_fn_vGetHModuleDbg();

  bStaticFunctions_Loaded = TRUE;
}
#endif //ifdef USE_STATIC_MODULE
  
#ifdef USE_MPEG_MODULE
//-----------------------------------------------------------
//	SND_DllEntryPoints_MpegFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_MpegFunctions(HMODULE hDLLModule)
{
	if (bMpegFunctions_Loaded)
		return;

#ifndef NO_ACP_LDBIN
	SND_DLL_GetProcAddress(SND_fn_bCanFreeDataMPEG,hDLLModule);
#endif
#ifndef SNDDLL_MODULE //fonctions inutiles pour la LIB statiques
//Module SndMpeg.h
	SND_DLL_GetProcAddress(SND_fn_lPlayMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_iInitMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestInitMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitMPEG,hDLLModule);

	#ifndef SPEEDBUSTER
	SND_DLL_GetProcAddress(SND_fn_tdGetResForVoiceMPEG,hDLLModule);
	#endif
//	SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResScriptMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryMPEG,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vLoadResFromDiskMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vUnLoadResMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsResLoadedMPEG,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vSetResUnloadedMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_lPlayTransitionMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMPEG2,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopTransitionMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseTransitionMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeTransitionMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vReleaseDriverMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRestoreDriverMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_rGetPosMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetLengthMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vSynchroMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferExMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lGetPosBufferExMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPushBufferExMPEG,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOffMPEG,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceMPEG,hDLLModule);


	SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeMPEG,hDLLModule);

#endif //SNDDLL_MODULE 

    bMpegFunctions_Loaded = TRUE;
}
#endif //ifdef USE_MPEG_MODULE  


#ifdef USE_WAV_MODULE
//-----------------------------------------------------------
//	SND_DllEntryPoints_WavFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_WavFunctions(HMODULE hDLLModule)
{
	if (bWavFunctions_Loaded)
		return;

	//Module Sndxd.h
	#ifndef SPEEDBUSTER
	SND_DLL_GetProcAddress(SND_fn_lPlaySxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetSoundVolumeSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_ucGetSoundVolumeSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetStereoSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bGetStereoSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetReverseStereoSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bGetReverseStereoSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_iInitSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestInitSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetDopplerFactorSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetEffectSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lCreateMicroSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetMicroParamSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDestroyMicroSxd,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_tdGetResForVoiceSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetParamBufferSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDeleteBufferSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseBufferSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeBufferSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_pvGetPtrBufferSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferExSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lGetPosBufferExSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPushBufferExSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResScriptSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResBinarySxd,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vLoadResFromDiskSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vUnLoadResSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsResLoadedSxd,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vSetResUnloadedSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPlayTransitionExSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxd2,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopTransitionSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseTransitionSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeTransitionSxd,hDLLModule);
#ifndef NO_ACP_LDBIN
	SND_DLL_GetProcAddress(SND_fn_bCanFreeDataSample,hDLLModule);
#endif
	SND_DLL_GetProcAddress(SND_fn_vReleaseDriverSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRestoreDriverSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vForceReleaseDriverSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vForceRestoreDriverSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetPosSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetLengthSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetPosBufferSxd,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vGetTargetLabelSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetupTargetSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bCanSetupTargetSxd,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vSynchroSxd,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vParam3Dto2D,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOffSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceSxd,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vSetNbVoiceWishedSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lGetNbVoiceOptimumSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lGetNbVoiceWishedSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_eGetMainFormatSxd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeSxd,hDLLModule);
	#endif

    bWavFunctions_Loaded = TRUE;
}
#endif //ifdef USE_WAV_MODULE  

#ifdef USE_RECORD_MODULE
//-----------------------------------------------------------
//	SND_DllEntryPoints_RecFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_RecordFunctions(HMODULE hDLLModule)
{
	if (bRecordFunctions_Loaded)
		return;

	#ifndef SPEEDBUSTER
	SND_DLL_GetProcAddress(SND_fn_bTestFormatRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lCreateBufferRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsBufferFullDuplexRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bStartRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsWorkingRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPushBufferToRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bManageMsgForRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_iInitRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitRecord,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_ucGetInstantVuMeterRecord,hDLLModule);
	#endif

    bRecordFunctions_Loaded = TRUE;
}
#endif //ifdef USE_RECORD_MODULE

#ifdef USE_CD_MODULE
//-----------------------------------------------------------
//	SND_DllEntryPoints_CdFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_CdFunctions(HMODULE hDLLModule)
{
	if (bCdFunctions_Loaded)
		return;

	#ifndef SPEEDBUSTER
	//Module Sndmidi.h
	SND_DLL_GetProcAddress(SND_fn_bLoadResScriptMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsResLoadedMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestInitMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_iInitMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPlayMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPlayMidiWithFade,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vUnLoadResMidi,hDLLModule);
#ifndef NO_ACP_LDBIN
	SND_DLL_GetProcAddress(SND_fn_bCanFreeDataMidi,hDLLModule);
#endif
	SND_DLL_GetProcAddress(SND_fn_vReleaseDriverMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRestoreDriverMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetPosMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetLengthMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSynchroMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPlayTransitionMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopTransitionMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeTransitionMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseTransitionMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMidi,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMidi2,hDLLModule);

	//Module SndCD.h
	SND_DLL_GetProcAddress(SND_fn_bLoadResScriptCd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryCd,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestInitCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_iInitCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPlayCD,hDLLModule);
//	SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vReleaseDriverCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRestoreDriverCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetPosCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetLengthCD,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_vSynchroCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSynchroMidi,hDLLModule);

	SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceMidi,hDLLModule);


	SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeCD,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeMidi,hDLLModule);
	#endif

	bCdFunctions_Loaded=TRUE;
}
#endif

#ifdef USE_DBG_MODULE
//-----------------------------------------------------------
//	SND_DllEntryPoints_DbgFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_DbgFunctions(HMODULE hDLLModule)
{
	if (bDbgFunctions_Loaded)
		return;

	//Module Snddbg.h
	SND_DLL_GetProcAddress(SND_fn_vLaunchSupervisater,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vKillSupervisater,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetSupervisaterActive,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsSupervisaterActive,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSetProjectTitleForSuperVisater,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vAddEventToObject,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vKillEventToObject,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSetPosObject,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vAddMicro,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vKillMicro,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSetPosMicro,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vAddHistoric,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vKillVolumeLine,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vAddVolumeLine,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSetVolumeLine,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vLoadBank,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vUnLoadBank,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vAddVoiceSample,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSetParVoiceSample,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vDelVoiceSample,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vPauseVoiceSample,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vResumeVoiceSample,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vSetProcessTimeSample,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_pstGetSelectedResource,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_bDoesSupervisaterSelectResource,hDLLModule);
//	SND_DLL_GetProcAddress(dbgSND_fn_vRajListesSxdVirtual,hDLLModule); obsolete
	SND_DLL_GetProcAddress(dbgSND_fn_vRajListesSxdVirtual2,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vInitListesSxdVirtual,hDLLModule);
	SND_DLL_GetProcAddress(dbgSND_fn_vRefreshSupervisater,hDLLModule);

	bDbgFunctions_Loaded=TRUE;
}
#endif

#if defined(USE_ADPCM_MODULE) && !defined(DISABLE_ADPCM)
//-----------------------------------------------------------
//	SND_DllEntryPoints_AdpcmFunctions(HMODULE hDLLModule)
//
//	But			: Calculer dynamiquement les adresses des fonctions fournies
//					par le module EXE aux autres DLLs
//	Entrées : HANDLE du module dans lequel se trouve ces fonctions.
//	Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_AdpcmFunctions(HMODULE hDLLModule)
{
	if (bAdpcmFunctions_Loaded)
		return;

#ifndef NO_ACP_LDBIN
	SND_DLL_GetProcAddress(SND_fn_bCanFreeDataADPCM,hDLLModule);
#endif
#ifndef SNDDLL_MODULE //fonctions inutiles pour la LIB statiques
	//Module Sndxdapm.h
	SND_DLL_GetProcAddress(SND_fn_lPlaySxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vStopSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetPosSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetLengthSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetSoundVolumeSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetStereoSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bGetStereoSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetReverseStereoSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bGetReverseStereoSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_iInitSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bTestInitSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDesInitSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetEffectSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vCreateMicroSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetMicroParamSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDestroyMicroSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetParamBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vDeleteBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_pvGetPtrBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_rGetPosBufferSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResScriptSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResBinarySxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResScriptAndConvertToWAVSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryAndConvertToWAVSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vUnLoadResSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsResLoadedSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPlayTransitionSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxdADPCM,hDLLModule);
	#ifndef SPEEDBUSTER
	SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxdADPCM2,hDLLModule);
	#endif
	SND_DLL_GetProcAddress(SND_fn_vStopTransitionSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vPauseTransitionSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vResumeTransitionSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vReleaseDriverSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vRestoreDriverSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vGetTargetLabelSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetupTargetSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bCanSetupTargetSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSynchroSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferExSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lGetPosBufferExSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lPushBufferExSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOffSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsResourceLoopingSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_lGetNbVoiceWishedSxdADPCM,hDLLModule);
	SND_DLL_GetProcAddress(SND_fn_bIsLibActiveSxdADPCM,hDLLModule);
	#ifndef SPEEDBUSTER
	SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeSxdADPCM,hDLLModule);
	#endif
#endif //SNDDLL_MODULE //fonctions inutiles pour la LIB statiques

	bAdpcmFunctions_Loaded=TRUE;
}
#endif

#if defined(SNDDLL_MODULE)
#include "sndthrd.h"
#endif

#if defined(DLLCD_MODULE)
#endif

#if defined(DLLMPEG_MODULE)
#endif

#if defined(DLLWAV_MODULE)
#include "sndxd.h"
#endif

/*
BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason,LPVOID lpvReserved)
{

   switch (fdwReason) {

      case DLL_PROCESS_ATTACH:
         // DLL is attaching to the address space
         // of the current process.

#ifdef _SUBCLASSCDPLAYER
            SND_g_hinstDll = hinstDll;
            SubclassProgManFrame(GetCurrentThreadId());
#endif            
         break;

      case DLL_THREAD_ATTACH:
         // A new thread is being created
         // in the current process.
         break;

      case DLL_THREAD_DETACH:
         // A thread is exiting cleanly.
         break;

      case DLL_PROCESS_DETACH:
         // The calling process is detaching the
         // DLL from its address space.
         break;
   }
   return(TRUE);
}
*/



