logic for loading audio files into the resource_map and
provides control of the loaded audio
Exports the unload() and has() functions from resource map
Found in Chapter 4, page 172 of the textbook
Example: 4.6 Audio Support- Source:
Methods
(static) cleanUp()
Closes the support for audio
- Source:
(static) incBackgroundVolume(increment)
Increment the volume of the background audio clip
Parameters:
| Name | Type | Description |
|---|---|---|
increment |
float | value to add to background volume |
- Source:
(static) incMasterVolume(increment)
Increment the Master volume
Parameters:
| Name | Type | Description |
|---|---|---|
increment |
float | the value to add to the volume |
- Source:
(static) init()
Initialize the web audio system support
- Source:
(static) isBackgroundPlaying() → {boolean}
Returns if there is background audio playing
- Source:
Returns:
true if there is background audio
- Type
- boolean
(static) load(path)
Load an audio file into the resource map
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | the path to the audio file |
- Source:
Returns:
(static) playBackground(path, volume)
Begins playing background audio file
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | path to the audio file |
volume |
float | the volume |
- Source:
(static) playCue(path, volume)
Play an audio cue
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | the path to the audio file |
volume |
float | the volume at which to play the audio |
- Source:
(static) setBackgroundVolume(volume)
Set the volume of the background audio clip
Parameters:
| Name | Type | Description |
|---|---|---|
volume |
float | the new background volume |
- Source:
(static) setMasterVolume(volume)
Set the Master volume
Parameters:
| Name | Type | Description |
|---|---|---|
volume |
float | the new master volume |
- Source:
(static) stopBackground()
Stop playing background music and clear the variable
- Source: