Static
MAX_The max volume to be used
Static
MIN_The min volume to be used
Static
MAX_The max number of sounds that can be recycled
Static
MAX_The max speed this sound can be played at
Static
FRAME_The frame rate at which to fade the sounds
The version of the module.
Optional
_previousOptional
readyStatic
clampStatic
normalizeAPI for the developer to define when a sound can and cannot be played. Any sound that tries to play while this returns false will not play Enables a checker to become the master checker over whether a sound can play If their defined conditions return false, then the sound cannot be played
The function that will resolve to true or false denoting if a sound can be played
This instance
Function to adjust master volume
The number to change the volume to
This instance
Adds a filter to be applied to sounds.
The sound to apply add the filter to.
The filter to add.
Removes a filter from being applied to sounds.
The sound to apply remove the filter from.
The filter to remove.
Fades this sound to the specified volume in the specified duration via the specified ease
Optional
pVolume: number = 100The volume to fade to
Optional
pDuration: number = 5000The duration of the fade in ms
Optional
pEase: string = 'easeOutCubic'Easing function
Optional
pCallback: (() => void)Callback to be called when the fade is over
This instance
Master mute
This instance
Plays a sound that is not stored. Plays the sound only. You can only kill this sound, no repeat, no changing volume, etc
The path to the file
Optional
pVolume: number = 100The volume to play the sound
Optional
pStartTime: number = 0The start time of this sound (to play a clipped version)
Optional
pEndTime: numberThe end time of this sound (to play a clipped version)
Optional
pPlaybackRate: number = 1The rate at which the sound is played, Higher numbers for faster playback (MAX 10)
Optional
pCallback: (() => void)The source to this emitted sound. Call source.kill() to stop this sound while its playing. This is the only API this sound has
The path of the sound file
Optional
pVolume: numberThe volume of the sound
Optional
pStartTime: numberThe start time of this sound (to play a clipped version)
Optional
pEndTime: numberThe end time of this sound (to play a clipped version)
Optional
pSave: booleanWhether to save this sound, or recycle it when it's completed
Optional
pPlayUnfocused: booleanIf this sound is set to true then it will not be paused automatically when the game screen is not focused
Optional
pPlaybackRate: numberThe rate at which the sound is played, Higher numbers for faster playback (MAX 10)
Optional
pLoop: booleanWhether this sound should loop or not
This effectively stops all sounds in the game except those specified in the pException array
Optional
pException: Sound[]an array of sounds that should not stop
This instance
This effectively kills all sounds in the game and subjects them to be recycled
This instance
Pauses all sounds in the game
Optional
pFocus: booleanIf this function was called automatically by the game being unfocused
This instance
Resumes all sounds in games
Optional
pFocus: booleanIf this function was called automatically by the game being focused
This instance
Removes the loaded audio buffer data for this sound
The path of the sound file
This instance
Recycles the sound for reuse later instead of deleting it. All binding info on the sound is removed
The sound to recycle
This instance
Class for managing sounds ResonanceSingleton
License
Resonance does not have a license at this time. For licensing contact the author
Author
https://github.com/doubleactii
Safari does not support .ogg files, so if you are using safari, do not use .ogg files or this library will not play that sound on safari. Otherwise, you can use .ogg on any other platform. Cordova included. This supports mp3, wav, ogg, etc.