-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleAudio.h
More file actions
40 lines (27 loc) · 806 Bytes
/
ModuleAudio.h
File metadata and controls
40 lines (27 loc) · 806 Bytes
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
#ifndef __ModuleAudio_H__
#define __ModuleAudio_H__
#include "Module.h"
#include "SDL_mixer\include\SDL_mixer.h"
#define DEFAULT_MUSIC_FADE_TIME 2.0f
class ModuleAudio : public Module
{
public:
ModuleAudio(Application* app, bool start_enabled = true);
~ModuleAudio();
bool Init();
bool CleanUp();
void Save(JSON_file& config);
void Load(JSON_file& config);
// 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(unsigned int fx, int repeat = 0);
private:
Mix_Music* music = nullptr;
p2List<Mix_Chunk*> fx;
// config saved variables
bool stereo = true; // 0 : mono output, 1 : stereo output
};
#endif // __ModuleAudio_H__