Reference to the current sound manager instance.
Asset key for the sound.
Optionalconfig: SoundConfigAn optional config object containing default sound settings.
ReadonlycurrentCurrently playing marker. 'null' if whole sound is playing.
ReadonlydurationA value representing the duration, in seconds. It could be total sound duration or a marker duration.
ReadonlyisFlag indicating if sound is currently paused.
ReadonlyisFlag indicating if sound is currently playing.
ReadonlykeyAsset key for the sound.
Local reference to the sound manager.
ReadonlymarkersObject containing markers definitions.
Flag indicating if destroy method was called on this sound.
ReadonlytotalThe total duration of the sound in seconds.
ReadonlytotalA property that holds the value of sound's actual playback rate, after its rate and detune values has been combined with global rate and detune values.
Add a listener for a given event.
The event name.
The listener function.
Optionalcontext: anyThe context to invoke the listener with. Default this.
Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object. This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback.
Marker object.
Method used internally for applying config values to some of the sound properties.
Method used internally to calculate total playback rate of the sound.
Destroys this sound and all associated events and marks it for removal from the sound manager.
Calls each of the listeners registered for a given event.
The event name.
Additional arguments that will be passed to the event handler.
Return an array listing the events for which the emitter has registered listeners.
Return the number of listeners listening to a given event.
The event name.
Return the listeners registered for a given event.
The event name.
Remove the listeners of a given event.
The event name.
Optionalfn: FunctionOnly remove the listeners that match this function.
Optionalcontext: anyOnly remove the listeners that have this context.
Optionalonce: booleanOnly remove one-time listeners.
Add a listener for a given event.
The event name.
The listener function.
Optionalcontext: anyThe context to invoke the listener with. Default this.
Add a one-time listener for a given event.
The event name.
The listener function.
Optionalcontext: anyThe context to invoke the listener with. Default this.
Pauses the sound. This only works if the sound is currently playing.
You can inspect the isPlaying and isPaused properties to check the state.
Play this sound, or a marked section of it.
It always plays the sound from the start. If you want to start playback from a specific time you can set 'seek' setting of the config object, provided to this call, to that value.
OptionalmarkerName: string | SoundConfigIf you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. Default ''.
Optionalconfig: SoundConfigOptional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
Remove all listeners, or those of the specified event.
Optionalevent: string | symbolThe event name.
Remove the listeners of a given event.
The event name.
Optionalfn: FunctionOnly remove the listeners that match this function.
Optionalcontext: anyOnly remove the listeners that have this context.
Optionalonce: booleanOnly remove one-time listeners.
Removes a marker from the sound.
The name of the marker to remove.
Method used internally for resetting values of some of the config properties.
Resumes the sound. This only works if the sound is paused and not already playing.
You can inspect the isPlaying and isPaused properties to check the state.
Removes all listeners.
Stop playing this sound.
Update method called automatically by sound manager on every game step.
The current timestamp as generated by the Request Animation Frame or SetTimeout.
The delta time elapsed since the last frame.
Updates previously added marker.
Marker object with updated values.
Class containing all the shared state and behavior of a sound object, independent of the implementation.