Classes¶
Audio/Container
Brief descriptions¶
Classes |
|
Manages multiple audio assets. |
|
Manages a queue of audio source to be played. |
Detailed information¶
AudioAssetContainer¶
engine/core/modules/audio/include/nau/audio/audio_container.hpp
-
class AudioAssetContainer : public IAudioAsset¶
Manages multiple audio assets.
Public Functions
-
AudioAssetContainer(const eastl::string &name)¶
Initialization constructor.
- Parameters:
Container – [in] name.
-
~AudioAssetContainer()¶
Destructor.
-
virtual AudioSourcePtr instantiate() override¶
Creates another instance of the container depending on the container type.
New instance contents depend on the container kind.
If the container type is AudioContainerKind::Sequence, the underlying audio assets will be simply copied.
If the container type is AudioContainerKind::Random, a single, randomly picked asset will be copied.
If the container type is AudioContainerKind::Shuffle, the underlying audio assets will be copied but their order will be randomly changed.
-
virtual eastl::string name() const override¶
Retrieves the audio asset container name.
- Returns:
Name of the audio asset container.
-
AudioAssetList::iterator begin()¶
Retrieves an iterator to the first managed audio asset.
- Returns:
An iterator to the first managed audio asset.
-
AudioAssetList::iterator end()¶
Retrieves an iterator to a virtual element right after the last managed audio asset.
- Returns:
An iterator to a virtual element right after the last managed audio asset.
-
AudioContainerKind kind() const¶
Retrieves the audio asset container kind.
See instantiate for more details.
- Returns:
Container type.
-
void setKind(AudioContainerKind kind)¶
Changes the audio asset container type.
- Parameters:
kind – [in] Value to assign.
-
void add(AudioAssetPtr asset)¶
Adds the audio asset to the container.
- Parameters:
asset – [in] A pointer to the asset to add.
-
void remove(AudioAssetPtr asset)¶
Removes the asset from the container.
-
bool empty() const¶
Checks whether the container is empty.
- Returns:
true
if the container is empty,false
otherwise.
Private Members
-
std::unique_ptr<Impl> m_pimpl¶
-
AudioAssetContainer(const eastl::string &name)¶
AudioContainer¶
engine/core/modules/audio/include/nau/audio/audio_container.hpp
-
class AudioContainer : public IAudioSource¶
Manages a queue of audio source to be played.
Note that calling methods on an empty container is safe, but won’t result in anything.
Public Functions
-
AudioContainer() = default¶
-
virtual void play() override¶
Resumes the audio playback.
-
virtual void stop() override¶
Stops the audio playback.
-
virtual void pause() override¶
Pauses the audio playback.
-
virtual void seek(std::chrono::milliseconds ms) override¶
Changes the current audio source playback position.
- Parameters:
ms – [in] Position in milliseconds to change the current playback position to.
-
virtual std::chrono::milliseconds duration() const override¶
Retrieves the total duration of audio sources in the container.
- Returns:
Total audio source duration in milliseconds.
-
virtual std::chrono::milliseconds position() const override¶
Retrieves the playback position in the currently played audio source.
- Returns:
Playback position in the currently played audio source in milliseconds.
-
virtual bool isAtEnd() const override¶
Checks whether the playback in the currently played audio source has reached its end.
- Returns:
true
if the playback has reached its end,false
otherwise.
-
virtual bool isPlaying() const override¶
Checks whether an audio source from the container is currently being played.
- Returns:
true
if an audio source from the container is currently being played,false
otherwise.
-
virtual void setEndCallback(SoundCompletionCallback callback) override¶
Sets a callback to be dispatched when the playback of the last audio source in the queue reaches its end.
- Parameters:
callback – [in] Callback to use.
-
void addSource(AudioSourcePtr source)¶
Adds the audio source to the container.
- Parameters:
source – [in] A pointer to the audio source to add.
-
AudioContainer() = default¶