-
Notifications
You must be signed in to change notification settings - Fork 1
/
audio.h
46 lines (35 loc) · 774 Bytes
/
audio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef _AUDIO_H_
#define _AUDIO_H_
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
#include "resources.h"
class Audio
{
public:
enum {
SFX_SHOT,
SFX_DEATH,
SFX_COLLECT,
SFX_FLAME,
SFX_LASER,
};
enum {
MUSIC_TITLE,
MUSIC_BATTLE,
};
static const int MAX_SFX = 64;
static void init(); // call this only once, before all other methos
static void playMusic(int no, bool repeat=true);
static void stopMusic();
static void playSFX(int no);
static void quit(); // after quit() it is safe to call init() again
private:
static ALLEGRO_MIXER *mixer;
static ALLEGRO_VOICE *voice;
static ALLEGRO_AUDIO_STREAM *musicStream;
static ALLEGRO_SAMPLE *sfx[MAX_SFX];
static const char *musicFiles[];
Audio();
~Audio();
};
#endif