Music

Defines

TNT_MUSIC_SFX_ASSET_CACHE_INL
namespace tnt

Typedefs

template<unsigned I>
using music_cache = asset_cache<Mix_Music, I>
using small_music_cache = music_cache<10>
using medium_music_cache = music_cache<50>
using large_music_cache = music_cache<100>
template<int I>
using sfx_cache = asset_cache<Mix_Chunk, I>
using small_sfx_cache = sfx_cache<10>
using medium_sfx_cache = sfx_cache<50>
using large_sfx_cache = sfx_cache<100>
template<unsigned I>
class asset_cache<Mix_Chunk, I>

Public Functions

~asset_cache() noexcept
Mix_Chunk *get(std::string_view path)
void load(std::string_view path)
void remove(std::string_view path)

Private Members

std::byte memory[I * sizeof(Mix_Chunk*)]
std::pmr::monotonic_buffer_resource res = {memory, sizeof(memory)}
std::pmr::unordered_map<std::string, Mix_Chunk*> cache = {&res}
template<unsigned I>
class asset_cache<Mix_Music, I>

Public Functions

~asset_cache() noexcept
Mix_Music *get(std::string_view path)
void load(std::string_view path)
void remove(std::string_view path)

Private Members

std::byte memory[I * sizeof(Mix_Music*)]
std::pmr::monotonic_buffer_resource res = {memory, sizeof(memory)}
std::pmr::unordered_map<std::string, Mix_Music*> cache = {&res}