20#include "audio/Audio.h"
21#include "scene/Component.h"
36 void Update(
float deltaTime)
override;
39 void RegisterAudio(
const std::string &name, std::shared_ptr<Audio> &clip);
41 void Play(
const std::string &name,
bool loop =
false);
43 void Stop(
const std::string &name);
48 std::unordered_map<std::string, std::shared_ptr<Audio>> m_clips;
Plays one or more named audio clips, attached to a GameObject.
void RegisterAudio(const std::string &name, std::shared_ptr< Audio > &clip)
Add a clip under name; later calls reference it by that key.
void LoadProperties(const nlohmann::json &json) override
Read clips and properties from a serialised scene JSON entry.
bool IsPlaying(const std::string &name)
True iff the named clip is currently playing.
void Play(const std::string &name, bool loop=false)
Start the named clip; loop true loops forever.
void Update(float deltaTime) override
Push the owner's world position to every registered clip.
void Stop(const std::string &name)
Stop the named clip if it is currently playing.
#define COMPONENT(ComponentClass)