Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
AudioComponent.h File Reference

GameObject component that plays audio clips by name. More...

#include "audio/Audio.h"
#include "scene/Component.h"
+ Include dependency graph for AudioComponent.h:

Go to the source code of this file.

Classes

class  mnd::AudioComponent
 Plays one or more named audio clips, attached to a GameObject. More...
 

Namespaces

namespace  mnd
 

Detailed Description

GameObject component that plays audio clips by name.

Attach to any mnd::GameObject to give it a small library of named mnd::Audio clips. Each frame the component pushes the GameObject's world position to every clip so 3D spatialisation works without extra plumbing.

auto *src = enemy->AddComponent<mnd::AudioComponent>();
auto growl = mnd::Audio::Load("sfx/growl.wav");
src->RegisterAudio("growl", growl);
src->Play("growl", true); // looping
Plays one or more named audio clips, attached to a GameObject.
static std::shared_ptr< Audio > Load(const std::string &path)
Decode an audio file from disk and return a shared instance.
Definition Audio.cpp:74

Definition in file AudioComponent.h.