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

A sound emitter: one clip, how loud, and where it is heard from. More...

#include <audio_source.h>

Public Attributes

float volume = 1.0f
 Linear gain, multiplied into the listener's own.
float pitch = 1.0f
 Playback rate multiplier; also shifts the pitch. Must be > 0.
bool loop = false
 Restart at the end instead of finishing.
bool spatial = true
 Whether the source is positioned in the world or mixed flat at constant volume.
bool playOnStart = true
 Start playing on the first frame the simulation runs.
float minDistance = 1.0f
 Radius inside which the source is at full volume: the size of the emitter.
float maxDistance = 50.0f
 Distance at which the source is inaudible.
bool playing = false
 Session state.
bool started = false
 Whether playOnStart has been honoured; session state.

Detailed Description

A sound emitter: one clip, how loud, and where it is heard from.

playing is the state the source wants, not a device report; it reads back false when a one-shot finishes. One sound per source, so overlapping copies want a source each; the playback cursor is read via AudioDevice::voiceCursor. A spatial source wants a mono clip (docs/reference/audio.md, "A positioned source wants a mono clip").

Member Data Documentation

◆ playOnStart

bool Vkm::Engine::AudioSource::playOnStart = true

Start playing on the first frame the simulation runs.

Gated on simulation time, not on the source existing, so the editor stays quiet. See engine.md, "Authored state and session state on one component".

◆ maxDistance

float Vkm::Engine::AudioSource::maxDistance = 50.0f

Distance at which the source is inaudible.

Attenuation is linear between the two; at or below minDistance disables it.


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