Constructor
# new AudioFx(eagerLoad)
Create a new Audio FX handler.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
eagerLoad |
boolean
|
true | Whether or not to eager-load audio objects |
Classes
Methods
# load(keys) → {void}
Load audio FX objects.
Parameters:
Name | Type | Description |
---|---|---|
keys |
array
|
the audio to load e.g. "soundtrack", "weapons", "snippets" |
void
# snippet(params) → {void}
Handle audio FX snippet.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
name |
string
|
null
|
The name of the audio FX snippet to play |
random |
boolean
|
If name is null and this is set to true, plays a random snippet |
void
# stop(key) → {void}
Stop the selected audio FX.
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
the audio key e.g. "weapon", "snippet" |
void
# async volume(key, level) → {void}
Set the volume for the selected audio object.
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
the audio key e.g. "soundtrack", "weapon", "snippet" |
level |
number
|
the volume level |
void
# weapon(params, action, playbackRate) → {void}
Handle weapon audio FX.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
weaponIndex |
number
|
null
|
The selected weapon index |
equippedWeapon |
string
|
null
|
The selected weapon object if no index is passed |
action |
string
|
the weapon audio action to play e.g. "fire" or "reload" |
playbackRate |
number
|
the weapon audio playback rate |
void