-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleAudio.h
64 lines (49 loc) · 1.08 KB
/
ModuleAudio.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef __MODULEAUDIO_H__
#define __MODULEAUDIO_H__
#include <vector>
#include "Module.h"
enum AUDIO_TYPE {
AUD_BULLET,
AUD_COPTER,
AUD_COPTER_BOMB,
AUD_EXPLOSION,
AUD_LIVE_UP,
AUD_PINCHAZO,
AUD_ROCKET,
AUD_SPRAY,
AUD_TURN
};
#define DEFAULT_MUSIC_FADE_TIME 2.0f
struct _Mix_Music;
struct Mix_Chunk;
typedef struct _Mix_Music Mix_Music;
class ModuleAudio : public Module
{
public:
ModuleAudio(bool start_enabled = true);
~ModuleAudio();
bool Start();
bool Resume();
bool Stop();
// Play a music file
bool PlayMusic(const char* path, float fade_time = DEFAULT_MUSIC_FADE_TIME);
// Load a WAV in memory
unsigned int LoadFx(const char* path);
// Play a previously loaded WAV
bool PlayFx(AUDIO_TYPE audio, int repeat = 0);
// Play a previously loaded WAV
void StopFx();
unsigned int bullet;
unsigned int copter;
unsigned int copter_bomb;
unsigned int explosion;
unsigned int live_up;
unsigned int pinchazo;
unsigned int rocket;
unsigned int spray;
unsigned int turn;
private:
Mix_Music* music = nullptr;
std::vector<Mix_Chunk*> fx;
};
#endif // __MODULEAUDIO_H__