-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModuleAudio.h
More file actions
66 lines (50 loc) · 1.03 KB
/
ModuleAudio.h
File metadata and controls
66 lines (50 loc) · 1.03 KB
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
65
66
#ifndef __ModuleAudio_H__
#define __ModuleAudio_H__
#include "Globals.h"
#include "Module.h"
#include "SDL_mixer\include\SDL_mixer.h"
#define MAX_SONGS 10
#define MAX_FX 64
enum type
{
MUSIC,
SFX
};
enum audio_state
{
PLAY,
STOP,
FADEIN,
FADEOFF,
};
struct sfx
{
Mix_Chunk* chunk;
char* name;
};
struct songsStruct
{
Mix_Music* songs;
char* name;
};
class ModuleAudio : public Module
{
private:
songsStruct songsArray[MAX_SONGS] = { nullptr };
sfx sfxArray[MAX_FX] = { nullptr };
//int last_chunk = 0;
//int last_song = 0;
public:
ModuleAudio();
~ModuleAudio();
bool Init();
//Mix_Chunk* const LoadSfx(const char* path, char *name);
//bool LoadMUS(const char* path, char *name);
bool LoadAudio(const char* path, char *name, type type);
void UnloadAudio(const char* name, type type);
//void UnloadMus(char* name);
//update_status update(); //not for now
void ControlAudio(char* name, type type, audio_state state, int loops = 0, float fadeInTimeMs = 1000.0f, float fadeOffTimeMs = 500.0f);
bool CleanUp();
};
#endif