#include "zelda.h"
#include "sound.h"

JGMOD *jgm;
void InstallSound()
{
   if(disableSound==TRUE)
    return;
   musicVol=200;
   digiVol=200;
   reserve_voices(16,-1);
   install_sound(DIGI_AUTODETECT,-1,NULL);
   install_mod(8);
   set_volume(musicVol,0);
}

void RemoveSound()
{
   if(disableSound==TRUE)
    return;
   remove_mod();
   remove_sound();
}

void PlaySample(SAMPLE *s,int vol,int pan,int freq,int loop)
{
   if(disableSound==TRUE)
    return;
   play_sample(s,digiVol,pan,freq,loop);
}

void PlayMod(char *name)
{
   if(disableSound==TRUE)
    return;
   jgm=load_mod(name);
   play_mod(jgm,TRUE);
}

void StopMod()
{
   if(disableSound==TRUE)
    return;
   stop_mod();
   if(jgm!=NULL)
    destroy_mod(jgm);
}
