//Active le son
#define SON

typedef struct ADGlobals
{
  const unsigned char *data;
  int last_sample;
  int last_index;
} ADGlobals;

extern ADGlobals ad;

#ifdef SON
    #define MIXBUF_SIZE 1216
	// A sample is 3 frames long
    #define SAMPLE_TIME (280896*3/MIXBUF_SIZE)

    extern void initInterrupt(void);
    extern void  InterruptHandler(void);

    extern int cur_mixbuf;
    extern signed char SON_ZERO[408];
    extern signed char EWRAM_DATA mixbuf[2][MIXBUF_SIZE];
    extern const unsigned char *audio_dat;
    extern const unsigned char *end;

    extern u16* videoBuffer;
    extern u16* paletteMem;

    extern signed char *Bruitage[4], *fin_bruitage[4];

    extern void JoueSon(int num_voie, int nom);
    extern void JoueMusique(const char *nom, int qualite, int transition);
    extern void dsound_vblank(void);
    extern void start_ad(const unsigned char *data);
    extern void mixer(int offset, int taille);
    extern void init_sound(void);
    
    extern int nBlank;
    extern void directSound();
	extern void vblHandlerGame();
	extern void IWRAM_CODE vcountHandlerGame();
    //extern void SSInterruptHandler(void);
    extern void DesactiveInterruptions();

    extern int nImages, niveau_eau, bgmap_scrlX, bgmap_scrlY;
    extern int jeuEnCours;

    extern u32 _ihScrlX, _ihScrlY;
    extern volatile int vblSet;

    enum SFX_FILES        {
        SFX_SAUT            =0x40,
        SFX_BORNE           =0x41,
        SFX_PERDU           =0x43,
        SFX_FREINAGE        =0x44,
        SFX_PIQUES          =0x46,
        
        SFX_PLAF            =0x4a,
        SFX_TOUCHEBOSS      =0x4c,
        SFX_BULLE           =0x4d,
        SFX_FLAMME          =0x4e,
        SFX_BOUCLIER        =0x4f,

        SFX_COULE           =0x52,
        SFX_BAGUE           =0x55,
        SFX_ECROULE         =0x59,
        
        SFX_APRESSPINDASH   =0x5c,
        SFX_TOMBE           =0x5d,
        SFX_MISEENBOULE     =0x5e,

        SFX_PETE            =0x61,
        SFX_DINGDING        =0x62,
        SFX_MINIEXPLOSION   =0x64,
        SFX_FINSCORE        =0x65,
        SFX_PERDBAGUES      =0x66,
        
        SFX_BUMPER          =0x6c,
        SFX_BIP             =0x6d,
        SFX_ARRIVEE         =0x6f,
    };

#endif



