20#ifndef DL_DISABLE_AUDIO
21#include <unordered_map>
88 void Init(std::string_view path_name);
110 _vecWhitelist = vec_load;
117 void Load(std::string_view name, std::string_view path_name);
146 std::string _strPath;
147 std::vector<std::string> _vecWhitelist;
149 std::unordered_map<std::string, size_t> _mapName2Buffer;
151 std::list<Sound::ID> _listDelete;
162inline gcSound snd_play(std::string_view name,
size_t group_id = 0,
float volume = 1.0f)
168 return g_audio->CreateDefault();
178#include <string_view>
181 inline void snd_play(std::string_view name,
size_t group_id = 0,
float volume = 1.0f)
void SetWhitelist(const std::vector< std::string > &vec_load)
设置加载白名单
void Init(std::string_view path_name)
初始化配置
std::vector< std::string > GetAllSound()
返回所有加载的音效名
void SetPath(std::string_view path)
设置资源路径(不设置则不会加载)
gcSound Create(std::string_view name)
创建一个声音
void _delete_sound(Sound *snd)
void Load(std::string_view name, std::string_view path_name)
加载一个音效
void SetLoop(bool loop)
设置循环
void SetVolume(float volume)
设置音量
auto get_gc(Args &&...args)
定义一个GC变量(引用计数内存池)
constexpr size_t NUM_MAX_FILE
可加载音频文件上限
gcSound snd_play(std::string_view name, size_t group_id=0, float volume=1.0f)
播放一个音效