-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAudioEngine.h
More file actions
48 lines (38 loc) · 811 Bytes
/
AudioEngine.h
File metadata and controls
48 lines (38 loc) · 811 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
41
42
43
44
45
46
47
48
#pragma once
#include <SDL\SDL.h>
#include <SDL\SDL_mixer.h>
#include <string>
#include <map>
namespace NeroEngine{
class SoundEffect{
public:
friend class AudioEngine;
void play(int loops = 0);
private:
Mix_Chunk* m_chunk = nullptr;
};
class Music{
public:
friend class AudioEngine;
void play(int loops = 1);
static void pause();
static void stop();
static void Music::resume();
private:
Mix_Music* m_music = nullptr;
};
class AudioEngine
{
public:
AudioEngine();
~AudioEngine();
void init();
void destroy();
SoundEffect loadSoundEffect(const std::string& filePath);
Music loadMusic(const std::string& filePath);
private:
bool m_isInitialized = false;
std::map<std::string, Mix_Chunk*> m_effectMap;
std::map<std::string, Mix_Music*> m_musicMap;
};
}