Familiar territory. WebAudio keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.
The audio object of Web Audio API.
function WebAudio()
Quick Reference
Setup & Creation 2
| initialize() | Sets up a new instance. |
| initialize() | Initializes the audio system. |
Checks (True / False) 3
| isReady() | Checks whether the audio data is ready to play. |
| isError() | Checks whether a loading error has occurred. |
| isPlaying() | Checks whether the audio is playing. |
Actions 9
| setMasterVolume() | Sets the master volume for all audio. |
| clear() | Clears the audio data. |
| play() | Plays the audio. |
| stop() | Stops the audio. |
| destroy() | Destroys the audio. |
| fadeIn() | Performs the audio fade-in. |
| fadeOut() | Performs the audio fade-out. |
| addLoadListener() | Adds a callback function that will be called when the audio data is loaded. |
| addStopListener() | Adds a callback function that will be called when the playback is stopped. |
Setup & Creation
initialize
method sourceWebAudio.prototype.initialize(url)
Sets up a new instance. (Same as the RPG Maker MZ method of this name.)
initialize
static sourceWebAudio.initialize()
Initializes the audio system.
Details
Initializes the audio system.
Checks (True / False)
isReady
method sourceWebAudio.prototype.isReady()
Checks whether the audio data is ready to play.
Details
Checks whether the audio data is ready to play.
isError
method sourceWebAudio.prototype.isError()
Checks whether a loading error has occurred.
Details
Checks whether a loading error has occurred.
isPlaying
method sourceWebAudio.prototype.isPlaying()
Checks whether the audio is playing.
Details
Checks whether the audio is playing.
Actions
setMasterVolume
static sourceWebAudio.setMasterVolume(value)
Sets the master volume for all audio.
Details
Sets the master volume for all audio.
clear
method sourceWebAudio.prototype.clear()
Clears the audio data.
play
method sourceWebAudio.prototype.play(loop, offset)
Plays the audio.
Details
Plays the audio.
stop
method sourceWebAudio.prototype.stop()
Stops the audio.
destroy
method sourceWebAudio.prototype.destroy()
Destroys the audio.
fadeIn
method sourceWebAudio.prototype.fadeIn(duration)
Performs the audio fade-in.
Details
Performs the audio fade-in.
fadeOut
method sourceWebAudio.prototype.fadeOut(duration)
Performs the audio fade-out.
Details
Performs the audio fade-out.
addLoadListener
method sourceWebAudio.prototype.addLoadListener(listner)
Adds a callback function that will be called when the audio data is loaded.
Details
Adds a callback function that will be called when the audio data is loaded.
addStopListener
method sourceWebAudio.prototype.addStopListener(listner)
Adds a callback function that will be called when the playback is stopped.
Details
Adds a callback function that will be called when the playback is stopped.
Other
seek
method sourceWebAudio.prototype.seek()
Gets the seek position of the audio.
retry
method sourceWebAudio.prototype.retry()
Tries to load the audio again.