|
NcEngine
|
Component managing audio clips. More...
#include <AudioSource.h>
Public Member Functions | |
| AudioSource (Entity entity, std::vector< asset::AudioClipView > clips={}, AudioSourceProperties properties=AudioSourceProperties{}) | |
| void | Play (uint32_t clipIndex=0ull) |
| Play the audio clip at a given index. | |
| void | PlayNext () |
| Play the audio clip following the one most recently played (round-robin). | |
| auto | IsPlaying () const noexcept -> bool |
| Check if a clip is currently playing. | |
| void | Queue (uint32_t clipIndex) |
| Preemptively set the next clip to be played. This can be started with Resume() instead of Play(). More... | |
| auto | GetQueuedClipIndex () const noexcept -> uint32_t |
| Get the index of the most recently queued or played clip. More... | |
| void | Stop () noexcept |
| Stop the currently playing audio clip, preserving the current position in the clip. | |
| void | Resume () |
| Continue playing from the last position. More... | |
| void | ResetPlayPosition () |
| Go back the beginning of the current playing or queued clip. | |
| auto | AddClip (const asset::AudioClipView &clip) -> uint32_t |
| Add an audio clip. More... | |
| void | SetClip (uint32_t clipIndex, const asset::AudioClipView &clip) |
| Replace the audio clip at a given index. | |
| void | RemoveClip (uint32_t clipIndex) |
| Remove the audio clip at a given index. More... | |
| auto | GetClips () const noexcept -> const std::vector< asset::AudioClipView > & |
| auto | GetProperties () const noexcept -> const AudioSourceProperties & |
| auto | GetGain () const noexcept -> float |
| auto | GetInnerRadius () const noexcept -> float |
| auto | GetOuterRadius () const noexcept -> float |
| auto | IsSpatial () const noexcept -> bool |
| auto | IsLooping () const noexcept -> bool |
| void | SetProperties (const AudioSourceProperties &properties) noexcept |
| void | SetGain (float gain) noexcept |
| void | SetInnerRadius (float radius) noexcept |
| void | SetOuterRadius (float radius) noexcept |
| void | SetSpatial (bool spatialize) noexcept |
| void | SetLooping (bool loop) noexcept |
Public Member Functions inherited from nc::ComponentBase | |
| ComponentBase (Entity entity) noexcept | |
| ComponentBase (const ComponentBase &)=delete | |
| ComponentBase (ComponentBase &&)=default | |
| ComponentBase & | operator= (const ComponentBase &)=delete |
| ComponentBase & | operator= (ComponentBase &&)=default |
| Entity | ParentEntity () const noexcept |
Friends | |
| class | audio::NcAudioImpl |
Component managing audio clips.
An AudioSource may hold any number of audio clips, but only one may be playing at a time. When the Spatial flag is set, the position of the owning Entity is used as the location of the AudioSource. For audio to be processed, a listener Entity must be registered with the NcAudio module.
| auto nc::AudioSource::AddClip | ( | const asset::AudioClipView & | clip | ) | -> uint32_t |
Add an audio clip.
|
inlinenoexcept |
Get the index of the most recently queued or played clip.
| void nc::AudioSource::Queue | ( | uint32_t | clipIndex | ) |
| void nc::AudioSource::RemoveClip | ( | uint32_t | clipIndex | ) |
Remove the audio clip at a given index.
| void nc::AudioSource::Resume | ( | ) |
Continue playing from the last position.