0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 10:13:42 +00:00
SDL_Minigame/include/SoundManager.h
Benedikt Galbavy 6a2e8289f6 fixed memory leaks
managers are no singletons anymore
2024-01-30 15:17:58 +01:00

32 lines
530 B
C++

#pragma once
#include <SDL_mixer.h>
#include <map>
#include <vector>
#include "TextureManager.h"
enum SoundTypes
{
STEPS,
THROW_EGG,
};
class SoundManager
{
public:
SoundManager() {}
~SoundManager() {
for (auto& it : this->sound_cache) {
Mix_FreeChunk(it.second);
}
}
SoundManager(SoundManager const&) = delete;
void operator=(SoundManager const&) = delete;
std::map<const char*, Mix_Chunk*> sound_cache;
Mix_Chunk* loadSound(const char* fileName);
static void playSound(SoundTypes sound);
};