Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
RaylibAudioManager.cpp
Go to the documentation of this file.
2
3void RaylibAudioManager::init() { InitAudioDevice(); }
4
6{
7 for (auto& [key, sound] : _sounds) UnloadSound(sound);
8 _sounds.clear();
9 CloseAudioDevice();
10}
11
12void RaylibAudioManager::playSound(const std::string& key, const std::string& filepath)
13{
14 if (!_sounds.contains(key)) _sounds[key] = LoadSound(filepath.c_str());
15 PlaySound(_sounds[key]);
16}
Raylib audio manager implementation.
void init() override
Initializes the Raylib audio device.
void shutdown() override
Unloads all cached sounds and closes the Raylib audio device.
std::unordered_map< std::string, Sound > _sounds
Caches loaded sounds to avoid reloading them.
void playSound(const std::string &key, const std::string &filepath) override
Loads the sound if not cached, then plays it via Raylib.