class

AudioSource

Module
Audio
Header
#include "Audio/AudioSource.h"
Namespace
Mowo

Constructors

SignatureNameDescription
AudioSource()AudioSource
~AudioSource()~AudioSource
AudioSource(const AudioSource&) = deleteAudioSourceNon-copyable, movable
AudioSource(AudioSource&& other) noexceptAudioSource

Public functions

ReturnsNameDescription
AudioSource&operator=
AudioSource&operator=
boolLoadLoad a sound file (VFS path).
boolLoad
boolSetSubmixRe-routes a loaded source to another submix; sends stay as they are.
const std::string&GetSubmixName
voidSetEnvelopeFollowerEnabledSends: a copy of this source into another submix at level, on top of its main route.
boolIsEnvelopeFollowerEnabled
floatGetEnvelopeRms
floatGetEnvelopePeak
boolSetSend
boolRemoveSend
floatGetSendLevel
size_tGetSendCount
boolLoadPcmStreamBind the source to a live PCM ring instead of a file — network voice, synthesised audio, anything produced frame by frame.
boolLoadPcmStream
uint32_tPushPcmStreamProducer side of a PCM stream.
uint32_tGetPcmStreamQueuedSamples
boolIsPcmStream
voidUnload
voidPlay
voidStop
voidPause
boolIsPlayingTrue while the voice is logically playing — including while virtualized, where the underlying ma_sound is stopped but the voice still owns a playback position.
boolIsAtEnd
boolWasStoppedTrue after Stop() — this voice's or one a concurrency group issued to make room — or when a full group refused Play(); false once it starts.
voidSetVolume
floatGetVolume
voidSetPitch
floatGetPitch
voidSetLooping
boolIsLooping
voidSetSpatial3D spatialization
voidSetPosition
voidSetMinDistance
voidSetMaxDistance
voidSetAttenuationModelAn ma_attenuation_model value.
voidSetRolloff
voidSetVelocity
voidGetVelocity
voidSetDopplerFactor
floatGetDopplerFactor
voidSetDirection
voidSetCone
voidFadeIn
voidFadeOut
voidFadeTo
voidSeekToFrame
voidSeekToSeconds
uint64_tGetCursorInFrames
floatGetCursorInSeconds
floatGetLengthInSeconds
voidSetLowPassCutoffPer-source low-pass filter (used by occlusion).
floatGetLowPassCutoff
boolAddEffectOrdered source effect chain (UE's Source Effect Chain): sound → occlusion/distance low-pass → effects[0] → effects[1] → … → envelope tap → sends/submix.
boolInsertEffect
boolRemoveEffect
voidClearEffects
size_tGetEffectCount
AudioEffect*GetEffect
voidAddParameterBindingParameter modulation (FAudioParameters).
voidClearParameterBindings
size_tGetParameterBindingCount
voidApplyParameterBindings
floatGetParameterVolumeScale
floatGetParameterPitchScale
floatGetAssetPitchThe clip's authored default pitch (its header), applied under SetPitch.
floatGetParameterCutoff
boolIsLoaded
boolIsStreamingTrue when the clip reads from disk as it plays rather than being resident.
floatGetLoudnessGainDbThe normalisation gain the cook stored in the clip, in dB.
uint64_tGetResidentBytesDecoded bytes this source holds in memory, counted against the engine's resident budget; 0 for a streaming or live source.
voidSetPriorityPriority is the primary ranking key of the voice budget (0..100, higher wins; effective volume breaks ties).
floatGetPriority
boolIsVirtual
floatGetPlaybackPositionSecondsVirtual-aware cursor: the tracked position while virtualized, the real ma_sound cursor otherwise.
VoiceHandleGetVoiceHandle
voidApplyExternalSpatializationExternal spatialization (FAudioSpatialization).
voidClearExternalSpatialization
boolIsExternallySpatialized
floatGetExternalGain
floatGetExternalPan
voidSetSoundClassSound class (FSoundClasses): its volume/pitch/low-pass, and every ancestor's and active mix's, ride on this source's modulation each tick.
const std::string&GetSoundClass
voidSetConcurrencyGroup
const std::string&GetConcurrencyGroup
voidSetCaptionTagWhat this voice is, for the acoustic compass (AudioEngine::QueryAudible): a captioned cue tags every voice it starts with its caption.
const std::string&GetCaptionTag
boolIsSpatialized
voidGetPosition
floatGetMinDistance
floatGetMaxDistance
voidVirtualizeVoiceAudioEngine's budget pass drives these three — do not call them from gameplay code, they bypass the registry's playing/virtual bookkeeping.
voidDevirtualizeVoice
voidEndVirtualVoice

Function details

AudioSource

C++
AudioSource()

~AudioSource

C++
~AudioSource()

AudioSource

C++
AudioSource(const AudioSource&) = delete

Non-copyable, movable

AudioSource

C++
AudioSource(AudioSource&& other) noexcept

operator=

C++
AudioSource& operator=(const AudioSource&) = delete

operator=

C++
AudioSource& operator=(AudioSource&& other) noexcept

Load

C++
bool Load(const std::string& filePath, AudioBus bus = AudioBus::SFX, bool streaming = false)

Load a sound file (VFS path). The bus form names one of the default submixes; the string form names any submix in the tree (a name that does not exist falls back to SFX with a warning).

Load

C++
bool Load(const std::string& filePath, const std::string& submix, bool streaming = false)

SetSubmix

C++
bool SetSubmix(const std::string& submix)

Re-routes a loaded source to another submix; sends stay as they are.

GetSubmixName

C++
const std::string& GetSubmixName() const

SetEnvelopeFollowerEnabled

C++
void SetEnvelopeFollowerEnabled(bool enabled)

Sends: a copy of this source into another submix at level, on top of its main route. Post-fader (the default) takes the signal after the source volume and its distance attenuation, so a fading source fades in the send too; pre-fader takes it after the attenuation but before the source volume, so a send level holds while the source is faded. Sends set before Load are applied by it. Setting a level of 0 keeps the send; RemoveSend drops it. A level tap on this source's own signal (after the occlusion filter, before the sends split). Lip-sync and meters read it; off by default because it is one more node per voice.

IsEnvelopeFollowerEnabled

C++
bool IsEnvelopeFollowerEnabled() const

GetEnvelopeRms

C++
float GetEnvelopeRms() const

GetEnvelopePeak

C++
float GetEnvelopePeak() const

SetSend

C++
bool SetSend(const std::string& submix, float level, bool preFader = false)

RemoveSend

C++
bool RemoveSend(const std::string& submix)

GetSendLevel

C++
float GetSendLevel(const std::string& submix) const

GetSendCount

C++
size_t GetSendCount() const

LoadPcmStream

C++
bool LoadPcmStream(uint32_t sampleRate, uint32_t channels, uint32_t ringSamples, AudioBus bus = AudioBus::Voice)

Bind the source to a live PCM ring instead of a file — network voice, synthesised audio, anything produced frame by frame. The source behaves like any other from here on: spatialization, min/max distance, attenuation model, rolloff and the occlusion low-pass all apply. Starvation plays silence rather than ending the sound.

LoadPcmStream

C++
bool LoadPcmStream(uint32_t sampleRate, uint32_t channels, uint32_t ringSamples, const std::string& submix)

PushPcmStream

C++
uint32_t PushPcmStream(const int16_t* samples, uint32_t count)

Producer side of a PCM stream. Returns the samples accepted; 0 means the ring was full and the block was dropped whole.

GetPcmStreamQueuedSamples

C++
uint32_t GetPcmStreamQueuedSamples() const

IsPcmStream

C++
bool IsPcmStream() const

Unload

C++
void Unload()

Play

C++
void Play()

Stop

C++
void Stop()

Pause

C++
void Pause()

IsPlaying

C++
bool IsPlaying() const

True while the voice is logically playing — including while virtualized, where the underlying ma_sound is stopped but the voice still owns a playback position.

IsAtEnd

C++
bool IsAtEnd() const

WasStopped

C++
bool WasStopped() const

True after Stop() — this voice's or one a concurrency group issued to make room — or when a full group refused Play(); false once it starts. Stop() rewinds, so IsAtEnd alone cannot tell a stopped voice from a paused one.

SetVolume

C++
void SetVolume(float volume)

GetVolume

C++
float GetVolume() const

SetPitch

C++
void SetPitch(float pitch)

GetPitch

C++
float GetPitch() const

SetLooping

C++
void SetLooping(bool loop)

IsLooping

C++
bool IsLooping() const

SetSpatial

C++
void SetSpatial(bool spatial)

3D spatialization

SetPosition

C++
void SetPosition(float x, float y, float z)

SetMinDistance

C++
void SetMinDistance(float dist)

SetMaxDistance

C++
void SetMaxDistance(float dist)

SetAttenuationModel

C++
void SetAttenuationModel(int32_t model)

An ma_attenuation_model value.

SetRolloff

C++
void SetRolloff(float rolloff)

SetVelocity

C++
void SetVelocity(float x, float y, float z)

GetVelocity

C++
void GetVelocity(float& x, float& y, float& z) const

SetDopplerFactor

C++
void SetDopplerFactor(float factor)

GetDopplerFactor

C++
float GetDopplerFactor() const

SetDirection

C++
void SetDirection(float x, float y, float z)

SetCone

C++
void SetCone(float innerRadians, float outerRadians, float outerGain)

FadeIn

C++
void FadeIn(float durationMs)

FadeOut

C++
void FadeOut(float durationMs)

FadeTo

C++
void FadeTo(float targetVolume, float durationMs)

SeekToFrame

C++
void SeekToFrame(uint64_t frame)

SeekToSeconds

C++
void SeekToSeconds(float seconds)

GetCursorInFrames

C++
uint64_t GetCursorInFrames() const

GetCursorInSeconds

C++
float GetCursorInSeconds() const

GetLengthInSeconds

C++
float GetLengthInSeconds() const

SetLowPassCutoff

C++
void SetLowPassCutoff(float cutoffHz)

Per-source low-pass filter (used by occlusion). Cutoff >= 19999 Hz removes the filter entirely (source plays through the bus directly); any lower value inserts/maintains a LowPassEffect between the sound and its bus group. Safe to call repeatedly from the same thread — re-attaches only when crossing the "enabled / disabled" boundary.

GetLowPassCutoff

C++
float GetLowPassCutoff() const

AddEffect

C++
bool AddEffect(Ref<AudioEffect> effect)

Ordered source effect chain (UE's Source Effect Chain): sound → occlusion/distance low-pass → effects[0] → effects[1] → … → envelope tap → sends/submix. The low-pass slot stays its own, so occlusion never competes with an authored filter for it. An effect lives in one chain; adding one already in this chain is refused. Effects come from the AudioEngine::Create*Effect factories and survive a reload of the clip.

InsertEffect

C++
bool InsertEffect(size_t index, Ref<AudioEffect> effect)

RemoveEffect

C++
bool RemoveEffect(AudioEffect* effect)

ClearEffects

C++
void ClearEffects()

GetEffectCount

C++
size_t GetEffectCount() const

GetEffect

C++
AudioEffect* GetEffect(size_t index) const

AddParameterBinding

C++
void AddParameterBinding(const FAudioParameterBinding& binding)

Parameter modulation (FAudioParameters). Bindings stack: Volume and Pitch bindings multiply onto the authored volume and pitch (Get/SetVolume and Get/SetPitch keep meaning the authored values), and the darkest LowPassCutoff binding sits under whatever SetLowPassCutoff asked for. AudioEngine::UpdateVoices re-evaluates every live source each tick.

ClearParameterBindings

C++
void ClearParameterBindings()

GetParameterBindingCount

C++
size_t GetParameterBindingCount() const

ApplyParameterBindings

C++
void ApplyParameterBindings()

GetParameterVolumeScale

C++
float GetParameterVolumeScale() const

GetParameterPitchScale

C++
float GetParameterPitchScale() const

GetAssetPitch

C++
float GetAssetPitch() const

The clip's authored default pitch (its header), applied under SetPitch.

GetParameterCutoff

C++
float GetParameterCutoff() const

IsLoaded

C++
bool IsLoaded() const

IsStreaming

C++
bool IsStreaming() const

True when the clip reads from disk as it plays rather than being resident. Set by Load(), from the cook's decision: a compressed source goes through miniaudio's own streaming decoder, a cooked .maudio through FMaudioFileStream.

GetLoudnessGainDb

C++
float GetLoudnessGainDb() const

The normalisation gain the cook stored in the clip, in dB. Applied under the authored volume, so SetVolume/GetVolume keep meaning what the caller asked for.

GetResidentBytes

C++
uint64_t GetResidentBytes() const

Decoded bytes this source holds in memory, counted against the engine's resident budget; 0 for a streaming or live source.

SetPriority

C++
void SetPriority(float priority)

Priority is the primary ranking key of the voice budget (0..100, higher wins; effective volume breaks ties). A source over budget is virtualized: its ma_sound stops feeding the mixer while AudioEngine keeps advancing the playback position, so de-virtualization resumes where it would have been had it never dropped out.

GetPriority

C++
float GetPriority() const

IsVirtual

C++
bool IsVirtual() const

GetPlaybackPositionSeconds

C++
float GetPlaybackPositionSeconds() const

Virtual-aware cursor: the tracked position while virtualized, the real ma_sound cursor otherwise.

GetVoiceHandle

C++
VoiceHandle GetVoiceHandle() const

ApplyExternalSpatialization

C++
void ApplyExternalSpatialization(float gain, float pan, float lowPassHz)

External spatialization (FAudioSpatialization). While a non-native spatializer runs, miniaudio's own spatializer is off for this voice and the plugin's gain, pan and low-pass apply instead; Clear hands the voice back to miniaudio. AudioEngine::UpdateVoices drives both.

ClearExternalSpatialization

C++
void ClearExternalSpatialization()

IsExternallySpatialized

C++
bool IsExternallySpatialized() const

GetExternalGain

C++
float GetExternalGain() const

GetExternalPan

C++
float GetExternalPan() const

SetSoundClass

C++
void SetSoundClass(const std::string& className)

Sound class (FSoundClasses): its volume/pitch/low-pass, and every ancestor's and active mix's, ride on this source's modulation each tick. Concurrency group: a full group applies its rule when Play is called.

GetSoundClass

C++
const std::string& GetSoundClass() const

SetConcurrencyGroup

C++
void SetConcurrencyGroup(const std::string& group)

GetConcurrencyGroup

C++
const std::string& GetConcurrencyGroup() const

SetCaptionTag

C++
void SetCaptionTag(const std::string& caption)

What this voice is, for the acoustic compass (AudioEngine::QueryAudible): a captioned cue tags every voice it starts with its caption.

GetCaptionTag

C++
const std::string& GetCaptionTag() const

IsSpatialized

C++
bool IsSpatialized() const

GetPosition

C++
void GetPosition(float& x, float& y, float& z) const

GetMinDistance

C++
float GetMinDistance() const

GetMaxDistance

C++
float GetMaxDistance() const

VirtualizeVoice

C++
void VirtualizeVoice()

AudioEngine's budget pass drives these three — do not call them from gameplay code, they bypass the registry's playing/virtual bookkeeping.

DevirtualizeVoice

C++
void DevirtualizeVoice(float positionSeconds)

EndVirtualVoice

C++
void EndVirtualVoice()
Generated from Audio/AudioSource.h via audio.json · Oct 26, 2026Version 1.0.0