Class AudioManager
Provides a way to load and play back .wav file sound effects.
Defined in: audio.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Load chunks of audio and play them by name.
|
| Method Attributes | Method Name and Description |
|---|---|
|
load(url, name)
Load a sample to play later.
|
|
|
play(name)
Play a sound.
|
Class Detail
AudioManager()
Load chunks of audio and play them by name. Only .wav files are really supported on all browsers. You could try .mp3 or .ogg but they probably won't work on all browsers. There is no way to get progress feedback on whether sounds are loaded yet, sorry, so use short sounds. Google 'sfxr' for an excellent sound effects generator.
Method Detail
load(url, name)
Load a sample to play later.
- Parameters:
- url
- is the path to the file to load.
- name
- is optional and is used to identify your sample for playing. If not supplied the filename minus the extension will be used.
play(name)
Play a sound.
- Parameters:
- name
- identifies which sound to play.
