//gestion du menu ED (module MNU) pour 
// target PW

//!!!! aucune fonction en peut être appelée
//seuls les prototypes sont exploités

#include "cpa_std.h"
#include "acp_base.h"
#include "hdl.h"
#include "mth.h"
#include "pos.h"
#include "geo.h"
#include "gli.h"
#include "gld.h"
#include "fon.h"
#include "mnu.h"

#include "SND.h"

#include "mnusnd.h"

//definitions des fct MNU
//!!!!!!! les conventions d'appel ne sont pas les mêmes pour toutes les fonctions
//		définir DLLCALL avec la valeur adéquat avant d'utiliser SND_DefinePointerx
#define DLLCALL
SND_DefinePointer_void2(MNU_fn_vAddCallback,void,MNU_tdpfn_Callback,char*);
SND_DefinePointer1(MNU_fn_lGetValue,long,MNU_tdxHandleOfSlider);
SND_DefinePointer2(MNU_fn_bSetValue,BOOL,MNU_tdxHandleOfSlider,short);
//defintions des fct SND
SND_DefinePointer0(SND_fn_bGetReverseStereoSound,SndBool);
SND_DefinePointer_void1(SND_fn_vSetReverseStereoSound,void,SndBool);


void fn_vMenuSon_InitStereo(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
	SndBool stereo;

	stereo=SND_fn_bGetReverseStereoSound();
	MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)(stereo ? 2 : 1));
}

void fn_vMenuSon_ChangeStereo(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
	long stereo;

	stereo=MNU_fn_lGetValue(hMenuItem->uItem.hSlider);
	SND_fn_vSetReverseStereoSound((stereo==2) ? TRUE : FALSE);
}

//Init géné
__declspec(dllexport) void SNDMNUInit(HINSTANCE hinst)
{
	//init des pointeurs de fonctions MNU
	DLLpfn_MNU_fn_vAddCallback=(DLLtdpfn_MNU_fn_vAddCallback)GetProcAddress(hinst,"MNU_fn_vAddCallback");
	DLLpfn_MNU_fn_lGetValue=(DLLtdpfn_MNU_fn_lGetValue)GetProcAddress(hinst,"MNU_fn_lGetValue");
	DLLpfn_MNU_fn_bSetValue=(DLLtdpfn_MNU_fn_bSetValue)GetProcAddress(hinst,"MNU_fn_bSetValue");
	//init des pointeurs de fonctions SND
	DLL_M_GetProcAddress(SND_fn_bGetReverseStereoSound,hinst);
	DLL_M_GetProcAddress(SND_fn_vSetReverseStereoSound,hinst);

	//init des callback MNU
	MNU_fn_vAddCallback(fn_vMenuSon_InitStereo,"InitStereo");
	MNU_fn_vAddCallback(fn_vMenuSon_ChangeStereo,"ChangeStereo");
}

