This repository has been archived on 2025-06-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
LotoStatek/headers/AudioManager.h
Andrii Solianyk 9d4af21d4d Migrated the whole main loop
The main loop of the game is now contained in Plansza class
2024-12-04 22:12:30 +01:00

25 lines
681 B
C++

#ifndef AUDIOMANAGER_H
#define AUDIOMANAGER_H
#include <SFML/Audio.hpp>
#include <unordered_map>
#include <string>
class AudioManager {
public:
AudioManager() = default;
bool loadBackgroundMusic(const std::string& filePath);
void playBackgroundMusic(float volume = 50.f, bool loop = true);
void stopBackgroundMusic();
bool loadSoundEffect(const std::string& name, const std::string& filePath);
void playSoundEffect(const std::string& name, float volume = 50.f);
private:
sf::Music backgroundMusic;
std::unordered_map<std::string, sf::SoundBuffer> soundBuffers;
std::unordered_map<std::string, sf::Sound> sounds;
};
#endif // AUDIOMANAGER_H