#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>

/* Ljud variabler*/
ALLEGRO_SAMPLE *zap;
ALLEGRO_SAMPLE *bom;
ALLEGRO_SAMPLE *mis;
ALLEGRO_SAMPLE *las;
ALLEGRO_SAMPLE *clk;

/* Initierar allegro ljud addons */
void ini_allegro_audio()
{
    al_install_audio();
    al_init_acodec_addon();
    al_reserve_samples(10);
}

/* Sätter alla ljud */
void ini_allegro_sounds()
{
    zap = al_load_sample("zap.efx.wav");
    bom = al_load_sample("bom.efx.wav");
    mis = al_load_sample("mis.efx.wav");
    las = al_load_sample("las.efx.wav");
    clk = al_load_sample("clk.efx.wav");
}

void ply_sound(int n)
{
    switch(n) {
        case 1:
            al_play_sample(zap,1,0,1,ALLEGRO_PLAYMODE_ONCE,NULL);
            break;
        case 2:
            al_play_sample(bom,1,0,1,ALLEGRO_PLAYMODE_ONCE,NULL);
            break;
        case 3:
            al_play_sample(mis,1,0,1,ALLEGRO_PLAYMODE_ONCE,NULL);
            break;
        case 4:
            al_play_sample(las,1,0,1,ALLEGRO_PLAYMODE_ONCE,NULL);
            break;
        case 5:
            al_play_sample(clk,.5,0,1,ALLEGRO_PLAYMODE_ONCE,NULL);
            break;
    }
}