vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::AudioClipAsset Struct Reference

A sound: fully decoded interleaved PCM, plus the rate and layout it was written at. More...

#include <audio_clip_asset.h>

Inheritance diagram for Vkm::Engine::AudioClipAsset:
Vkm::Engine::Resource

Public Member Functions

size_t sampleCount () const
 Total samples across all channels.
uint64_t frameCount () const
 Length in sample frames (one frame is one sample per channel).
float duration () const
 Length in seconds, or 0 when the clip carries no rate.
Public Member Functions inherited from Vkm::Engine::Resource
 Resource (const Resource &other)
 Duplicate other's contents and name, but not its identity.
const std::string & name () const noexcept
 Serializable identity; non-empty and unique within its type once added.
uint64_t uid () const noexcept
 Process-unique id stamped by add(); names the asset, not the slot it sits in.
uint64_t version () const noexcept
 Change counter the backend keys GPU re-uploads on; moved by commit().
bool isHidden () const noexcept
 Added by ResourceManager::addPrivate: not user-facing, not saved.
nlohmann::json & sourceJson ()
 Mutable source JSON, allocating a null document if there is none.
const nlohmann::json & sourceJson () const
 Const source JSON; asserts hasSource(), so guard the call with it.

Public Attributes

uint32_t sampleRate = 0
 Frames per second, as authored; AudioDevice resamples if it differs.
uint32_t channels = 0
 1 = mono, 2 = stereo, up to MAX_AUDIO_CHANNELS; only a mono clip positions.
ClipSamples samples
 Interleaved PCM, shared with the voices playing it.

Detailed Description

A sound: fully decoded interleaved PCM, plus the rate and layout it was written at.

Decoded once at load, not streamed: a Resource is a value built in staging and swapped in whole, which a live decoder is not. The cooked file IS these samples, so a clip takes as much memory as disk.

Member Function Documentation

◆ frameCount()

uint64_t Vkm::Engine::AudioClipAsset::frameCount ( ) const
inline

Length in sample frames (one frame is one sample per channel).

Returns
The frame count; 0 for a clip with no channels.

The documentation for this struct was generated from the following file: