AudioVoice class abstract Audio

One playback of an AudioClip, created by AudioEngine.createVoice.

A voice is single-use. It is created paused so the caller can configure volume, routing, and 3D state without an audible pop, then begins with start. Once stopped (or finished naturally, for non-looping clips) it cannot be restarted; create a new voice instead. Backends release finished voices themselves, and every operation on a finished voice is a safe no-op.

Most code never touches voices directly. ClipAudioSource manages one per playback, and AudioEngine.playOneShot returns one for fire-and-forget control.

Constructors

AudioVoice()

Properties

hashCode int
The hash code for this object.
no setterinherited
isPaused bool
Whether playback is currently paused (including the initial pre-start pause).
no setter
isPlaying bool
Whether the voice is still live (audible or paused). false once stopped or finished.
no setter
looping bool
Whether the clip repeats until stopped.
no getter
pitch double
Playback rate multiplier. 1.0 is the clip's natural rate.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
volume double
Gain for this voice. 1.0 is unity. Multiplied with the routed bus chain.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
resume() → void
setBus(AudioBus? bus) → void
Routes this voice through bus, or the master bus when null. Must be set before start; rerouting a started voice is backend-dependent.
setPositional(bool positional) → void
Selects 3D or 2D playback. Must be set before start.
start() → void
Begins playback. Calling it again after the voice started is a no-op.
stop() → void
Ends this playback permanently.
toString() String
A string representation of this object.
inherited
update3d(Vector3 position, Vector3 velocity, AudioAttenuation attenuation) → void
Pushes this frame's 3D state. Called every frame for positional voices while the owning source is mounted.

Operators

operator ==(Object other) bool
The equality operator.
inherited