diff options
author | Nikolas <nikolas@boutalas.com> | 2024-10-27 12:52:55 +0200 |
---|---|---|
committer | Nikolas <nikolas@boutalas.com> | 2024-10-27 12:52:55 +0200 |
commit | 43394c8a8908442982e3a7e25975c31b3c952923 (patch) | |
tree | 2facd563e29f48fe3b0653ac5c113998940b4d5e /graphics/AudioManager.h |
Diffstat (limited to 'graphics/AudioManager.h')
-rw-r--r-- | graphics/AudioManager.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/graphics/AudioManager.h b/graphics/AudioManager.h new file mode 100644 index 0000000..f323cc7 --- /dev/null +++ b/graphics/AudioManager.h @@ -0,0 +1,20 @@ +#pragma once + +#include <unordered_map> +#include <string> +#include <SDL2/SDL.h> +#include <SDL2/SDL_mixer.h> + +class AudioManager +{ + std::unordered_map<std::string, Mix_Chunk*> sounds; + std::unordered_map<std::string, Mix_Music*> scores; + bool initialized = true; +public: + void playSound(std::string soundfile, float volume, bool looping = false); + void playMusic(std::string soundfile, float volume, bool looping = true, int fade_time = 0); + void stopMusic(int fade_time = 0); + AudioManager(); + ~AudioManager(); + +};
\ No newline at end of file |