45 #ifndef __CU_MUSIC_LOADER_H__
46 #define __CU_MUSIC_LOADER_H__
47 #include <cugl/assets/CULoader.h>
48 #include <cugl/audio/CUMusic.h>
94 void materialize(
const std::string& key,
const std::shared_ptr<Music>& music,
115 virtual bool read(
const std::string& key,
const std::string& source,
141 virtual bool read(
const std::shared_ptr<JsonValue>& json,
146 #pragma mark Constructors
183 static std::shared_ptr<MusicLoader>
alloc() {
184 std::shared_ptr<MusicLoader> result = std::make_shared<MusicLoader>();
185 return (result->init() ? result :
nullptr);
202 static std::shared_ptr<MusicLoader>
alloc(
const std::shared_ptr<ThreadPool>& threads) {
203 std::shared_ptr<MusicLoader> result = std::make_shared<MusicLoader>();
204 return (result->init(threads) ? result :
nullptr);
208 #pragma mark Properties
void setVolume(float volume)
Definition: CUMusicLoader.h:227
std::shared_ptr< ThreadPool > _loader
Definition: CULoader.h:102
void dispose() override
Definition: CUMusicLoader.h:166
void materialize(const std::string &key, const std::shared_ptr< Music > &music, float volume, LoaderCallback callback)
static std::shared_ptr< MusicLoader > alloc()
Definition: CUMusicLoader.h:183
float getVolume() const
Definition: CUMusicLoader.h:217
float _volume
Definition: CUMusicLoader.h:76
std::unordered_map< std::string, std::shared_ptr< Music > > _assets
Definition: CULoader.h:678
std::function< void(const std::string &key, bool success)> LoaderCallback
Definition: CULoader.h:81
static std::shared_ptr< MusicLoader > alloc(const std::shared_ptr< ThreadPool > &threads)
Definition: CUMusicLoader.h:202
Definition: CULoader.h:675
Definition: CUAnimationNode.h:52
Definition: CUMusicLoader.h:69
virtual bool read(const std::string &key, const std::string &source, LoaderCallback callback, bool async) override