0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 09:03:42 +00:00
SDL_Minigame/include/SoundManager.h
ineslelin cb01c54968 updated SoundManager
- loading music from sound file now possible
- looping sound effects is possible now
2024-05-26 19:06:52 +02:00

43 lines
797 B
C++

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