Manifest-driven cache for sf::SoundBuffer resources.
More...
#include <SoundManager.h>
Static Public Member Functions | |
| static const sf::SoundBuffer & | get (const Asset &asset) |
| Retrieve the cached resource for an asset enum value. | |
| static void | unload (Asset asset) |
| Remove a resource from the cache. | |
Manifest-driven cache for sf::SoundBuffer resources.
SoundManager<Manifest> extends ResourceManager to provide lazy-loaded, cached access to sound buffers declared in a manifest's Sounds enum.
The cached sf::SoundBuffer can be assigned to an sf::Sound instance for playback. The buffer remains valid for the lifetime of the application (or until unload() is called).
| Manifest | A Manifest subclass with a Sounds enum whose values map to audio file paths. |
Definition at line 49 of file SoundManager.h.
|
staticinherited |
Retrieve the cached resource for an asset enum value.
Loads and caches on first access. Throws std::runtime_error if the path is not registered or loading fails.
| Asset | An enum type declared inside Manifest. |
| asset | The specific enum value to load. |
Resource.
|
staticinherited |
Remove a resource from the cache.
The next get(asset) call will reload from disk. If called during draw(), the unload is deferred until after the frame completes to prevent mid-frame dangling references.
| Asset | The enum type of the key to remove. |
| asset | The specific enum value to evict from the cache. |