Extends
- EventTarget
Members
(protected) muteExeptions_ :Array.<string>
- Description:
Defines a list of sound keys (file names without the extension) which should be excluded from muting.
- Source:
Defines a list of sound keys (file names without the extension) which should be excluded from muting.
Type:
- Array.<string>
muted
- Description:
Setter
- Source:
Setter
muted
- Description:
Getter
- Source:
Getter
(protected) muted_ :boolean
- Description:
Defines if all handled sounds should be muted.
- Source:
Defines if all handled sounds should be muted.
Type:
- boolean
soundAssetPath
- Description:
Setter
- Source:
Setter
soundAssetPath
- Description:
Getter
- Source:
Getter
(protected) soundAssetPath_ :string
- Description:
Defines the default relative sound asset path.
- Source:
Defines the default relative sound asset path.
Type:
- string
soundAssetUrl
- Description:
Getter
- Source:
Getter
(protected) soundAssetUrl_ :string
- Description:
It is an absolute asset URL if the variable
window.ASSET_URL
is set, otherwise it is the relative HowlerSoundProvider#soundAssetPath_.
- Source:
It is an absolute asset URL if the variable window.ASSET_URL
is set, otherwise it is the relative HowlerSoundProvider#soundAssetPath_.
Type:
- string
(protected) soundLoadPromise_ :Map.<string, Promise>
- Description:
List of stored loading promises, where key ist the file name (without the extension).
- Source:
List of stored loading promises, where key ist the file name (without the extension).
Type:
- Map.<string, Promise>
(protected) sounds_ :Map.<string, HowlSound>
- Description:
All loaded sounds will be saved in this list. The key is the sound file name (without the extension).
- Source:
All loaded sounds will be saved in this list. The key is the sound file name (without the extension).
Type:
- Map.<string, HowlSound>
Methods
addMuteExeptions(keyOrArrayOfKeys)
- Description:
Adds a sound key or a list of sound keys (file names without the extension) to the exclude list for muting.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
keyOrArrayOfKeys |
string | Array.<string> | Key is a file name without the extension |
changeVolume(key, volume)
- Description:
Change the volume of the sound with the given key (file name without the extension)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
volume |
number |
fadeSound(key, from, to, duration, loopopt, preventStopopt) → {Promise}
- Description:
Fade the volume of the sound with the given key (file name without the extension) Returns a promise that is fulfilled when the sound fade was completed.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | Sound file name without the extension |
||
from |
number | Starting volume |
||
to |
number | Starting volume |
||
duration |
number | in seconds |
||
loop |
boolean |
<optional> |
false
|
after fading |
preventStop |
boolean |
<optional> |
false
|
Returns:
- Type
- Promise
getActiveInstanceKeys() → {Array.<string>}
- Description:
Gets a list of sound keys (filenames without extension) where the sound is currently playing.
- Source:
Returns:
- Type
- Array.<string>
getSoundByKey(key) → {HowlSound}
- Description:
Gets the sound instance of a sound with the given key (file name without the extension).
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
Returns:
- Type
- HowlSound
getSoundDuration(key) → {number}
- Description:
Gets the duration of a sound with the given key (file name without the extension).
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
Returns:
- Type
- number
(protected) isJsonFile_(path) → {boolean}
- Description:
Check if the specified file path represents a json file.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
path |
string |
Returns:
- Type
- boolean
isSoundPlaying(key) → {boolean}
- Description:
Checks if a sound with the given key (file name without the extension) is playing.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
Returns:
- Type
- boolean
load(sounds, preventCDNServiceopt) → {Promise}
- Description:
Loads a sound or a list of sounds and store them in the HowlerSoundProvider#sound_ list. It is also possible to use a manifest.json to load the sounds. Returns a promise that is fulfilled when the source is loaded and saved in the HowlerSoundProvider#soundLoadPromise_ list.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
sounds |
Array.<string> | string | File path(s). |
||
preventCDNService |
boolean |
<optional> |
false
|
Prevent loading over a cdn url, which is part of HowlerSoundProvider#soundAssetUrl_. Loading path will be relative stating with HowlerSoundProvider#soundAssetPath_. |
Returns:
- Type
- Promise
muteSoundByKey(key, value)
- Description:
Mute or unmute a sound with the given key (file name without the extension).
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
value |
boolean |
pauseSound(key, enable) → {Promise}
- Description:
Pause or unpause a sound with the given key (file name without the extension).
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
enable |
boolean |
Returns:
- Type
- Promise
playSound(key, volumeopt, loopopt) → {Promise}
- Description:
Play a sound with the given key (file name without the extension) Returns a promise that is fulfilled when the sound was played.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
string | Sound file name without the extension |
||
volume |
number |
<optional> |
1
|
|
loop |
boolean |
<optional> |
false
|
Returns:
- Type
- Promise
stopAllSounds()
- Description:
Stop all sounds
- Source:
stopSound(key) → {Promise}
- Description:
Stop a sound with the given key (file name without the extension). If the sound was playing its play promise will be rejected.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Sound file name without the extension |
Returns:
- Type
- Promise