46 #ifndef __CU_SOUND_LOADER_H__
47 #define __CU_SOUND_LOADER_H__
48 #include <cugl/assets/CULoader.h>
49 #include <cugl/audio/CUSound.h>
79 #pragma mark Asset Loading
96 void materialize(
const std::string& key,
const std::shared_ptr<Sound>& sound,
97 LoaderCallback callback);
117 virtual bool read(
const std::string& key,
const std::string& source,
118 LoaderCallback callback,
bool async)
override;
143 virtual bool read(
const std::shared_ptr<JsonValue>& json,
144 LoaderCallback callback,
bool async)
override;
149 #pragma mark Constructors
186 static std::shared_ptr<SoundLoader>
alloc() {
187 std::shared_ptr<SoundLoader> result = std::make_shared<SoundLoader>();
188 return (result->init() ? result :
nullptr);
205 static std::shared_ptr<SoundLoader>
alloc(
const std::shared_ptr<ThreadPool>& threads) {
206 std::shared_ptr<SoundLoader> result = std::make_shared<SoundLoader>();
207 return (result->init(threads) ? result :
nullptr);
211 #pragma mark Properties
std::shared_ptr< ThreadPool > _loader
Definition: CULoader.h:105
void setVolume(float volume)
Definition: CUSoundLoader.h:230
std::unordered_map< std::string, std::shared_ptr< Sound > > _assets
Definition: CULoader.h:736
virtual bool read(const std::string &key, const std::string &source, LoaderCallback callback, bool async) override
void dispose() override
Definition: CUSoundLoader.h:169
Definition: CULoader.h:733
float getVolume() const
Definition: CUSoundLoader.h:220
static std::shared_ptr< SoundLoader > alloc(const std::shared_ptr< ThreadPool > &threads)
Definition: CUSoundLoader.h:205
static std::shared_ptr< SoundLoader > alloc()
Definition: CUSoundLoader.h:186
Definition: CUAction.h:51
Definition: CUSoundLoader.h:70
void materialize(const std::string &key, const std::shared_ptr< Sound > &sound, LoaderCallback callback)
float _volume
Definition: CUSoundLoader.h:77