Creates an instance of the Playback class.
The Sound instance that the Playback is associated with.
The audio source node.
The gain node for controlling volume.
Throws an error if an invalid pan type is provided.
Private
_offsetPrivate
_playbackPrivate
_startPrivate
_statePrivate
Optional
bufferPrivate
contextOptional
gainThe Sound instance that the Playback is associated with.
Optional
pannerOptional
sourceGets the duration of the audio in seconds.
The duration of the audio or NaN if the duration is unknown.
Throws an error if the sound has been cleaned up.
Gets the current playback rate of the audio.
The current playback rate.
Sets the playback rate of the audio.
The playback rate to set.
Throws an error if the sound has been cleaned up or if the source type is unsupported.
Gets the position of the audio source in 3D space (HRTF panning only).
The [x, y, z] coordinates of the audio source.
Throws an error if the sound has been cleaned up or if HRTF panning is not used.
Sets the position of the audio source in 3D space (HRTF panning only).
The [x, y, z] coordinates of the audio source.
Throws an error if the sound has been cleaned up or if HRTF panning is not used.
Sets whether the audio source should loop.
Whether the audio should loop.
Throws an error if the sound has been cleaned up.
Gets the stereo panning value.
The current stereo pan value, or null if stereo panning is not applicable.
Throws an error if stereo panning is not available or if the sound has been cleaned up.
Sets the stereo panning value.
The stereo pan value to set, between -1 (left) and 1 (right).
Throws an error if stereo panning is not available, if the sound has been cleaned up, or if the value is out of bounds.
Gets the 3D audio options if HRTF panning is used.
The current 3D audio options.
Throws an error if the sound has been cleaned up or if HRTF panning is not used.
Sets the 3D audio options for HRTF panning.
The 3D audio options to set.
Throws an error if the sound has been cleaned up or if HRTF panning is not used.
Gets the current volume of the audio.
The current volume.
Throws an error if the sound has been cleaned up.
Sets the volume of the audio.
The volume to set.
Throws an error if the sound has been cleaned up.
Creates a clone of the current Playback instance with optional overrides for certain properties. This method allows for the creation of a new Playback instance that shares the same audio context and source node but can have different settings such as loop count or pan type.
An object containing properties to override in the cloned instance.
A new Playback instance cloned from the current one with the specified overrides applied.
Throws an error if the sound has been cleaned up.
Sets or gets the loop count for the audio.
Optional
loopCount: LoopCountThe number of times the audio should loop. 'infinite' for endless looping.
The loop count if no parameter is provided.
Throws an error if the sound has been cleaned up or if the source type is unsupported.
Private
recreatePrivate
refreshPrivate
setup
The base interface for any sound-producing entity, including individual sounds, groups, and playbacks. BaseSound