Private Optional _cacophonyPrivate _playbackOptional bufferPrivate eventPrivate globalRetrieves the duration of the sound in seconds. If the sound is based on an AudioBuffer, it returns the duration of the buffer. Otherwise, if the sound has not been played and is a MediaElementSource, it returns NaN, indicating that the duration is unknown or not applicable.
The duration of the sound in seconds.
Returns a boolean indicating whether the object is currently playing. an object is playing if any of its playbacks are currently playing.
True if the object is playing, false otherwise.
Retrieves the current 3D spatial position of the sound in the audio context. The position is returned as an array of three values[x, y, z].
The current position of the sound.
Sets the 3D spatial position of the sound in the audio context. The position is an array of three values[x, y, z]. This method updates the position of all active playbacks of the sound.
The new position of the sound.
Clones the current Sound instance, creating a deep copy with the option to override specific properties.
This method allows for the creation of a new, independent Sound instance based on the current one, with the
flexibility to modify certain attributes through the overrides parameter. This is particularly useful for
creating variations of a sound without affecting the original instance. The cloned instance includes all properties,
playback settings, and filters of the original, unless explicitly overridden.
An object specifying properties to override in the cloned instance. This can include audio settings like volume, playback rate, and spatial positioning, as well as more complex configurations like 3D audio options and filter adjustments.
A new Sound instance that is a clone of the current sound.
Protected emitProtected emitSets or retrieves the loop behavior for the sound. If loopCount is provided, the sound will loop the specified number of times. If loopCount is 'infinite', the sound will loop indefinitely until stopped. If no argument is provided, the method returns the current loop count setting.
Optional loopCount: LoopCountThe number of times to loop or 'infinite' for indefinite looping.
The current loop count setting if no argument is provided.
Remove event listener.
Register event listener.
Cleanup function
The base interface for any sound-producing entity, including individual sounds, groups, and playbacks. BaseSound