-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModuleAudio.h
44 lines (31 loc) · 867 Bytes
/
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
#ifndef __MODULEAUDIO_H__
#define __MODULEAUDIO_H__
#include <vector>
#include "Module.h"
#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 Init();
bool CleanUp();
// Play a music file
bool PlayMusic(const char* path, float fade_time = DEFAULT_MUSIC_FADE_TIME);
bool StopMusic(float fade_time);
// Load a WAV in memory
unsigned int LoadFx(const char* path);
// Play a previously loaded WAV
bool PlayFx(unsigned int fx, int repeat = 0);
bool PlayFxChannel(unsigned int id, int repeat, int channel);
//Stops music on all channels
bool StopFx();
bool StopFxChannel(int channel);
private:
Mix_Music* music = nullptr;
std::vector<Mix_Chunk*> fx;
};
#endif // __MODULEAUDIO_H__