Class: BufferSource
Defined in: src/audio/spatialAudioSources.ts:73
A PositionalSource that plays a decoded AudioBuffer.
A Web Audio AudioBufferSourceNode plays once, so this wrapper builds a
fresh node on each play. A shared GainNode carries the volume and
stays connected to the panner, so volume survives a replay.
Implements
Constructors
Constructor
new BufferSource(
_context,_buffer,_gain,_loop):BufferSource
Defined in: src/audio/spatialAudioSources.ts:82
Parameters
_context
BaseAudioContext
The owning context (makes the source nodes)
_buffer
AudioBuffer
The decoded audio to play
_gain
GainNode
A gain node already connected to the panner
_loop
boolean = false
Returns
BufferSource
Methods
pause()
pause():
void
Defined in: src/audio/spatialAudioSources.ts:99
Pause playback, keeping the position when the source supports it.
Returns
void
Implementation of
play()
play():
void
Defined in: src/audio/spatialAudioSources.ts:89
Start (or resume) playback.
Returns
void
Implementation of
setVolume()
setVolume(
value):void
Defined in: src/audio/spatialAudioSources.ts:108
Set the source volume, clamped to [0, 1].
Parameters
value
number
Returns
void
Implementation of
stop()
stop():
void
Defined in: src/audio/spatialAudioSources.ts:104
Stop playback and reset to the start.
Returns
void