Familiar territory. AudioManager keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.
Quick Reference
Setup & Creation 3
| loadStaticSe() | Loads the static se. |
| makeEmptyAudioObject() | Makes the empty audio object. |
| createBuffer() | Creates the buffer. |
Getting Information 2
| resolveSeVariant() | The SE to actually play. |
| _pickBgmSequencePoolEntry() | The next pool entry: in order, dealt from a shuffled bag, or drawn at random. |
Checks (True / False) 4
| isCurrentBgm() | Whether it is current bgm. |
| isCurrentBgs() | Whether it is current bgs. |
| isMissingLocalSe() | A missing one-shot sound must not stop the battle or start a new failed request for every hit. |
| isStaticSe() | Whether it is static se. |
Actions 27
| playBgm() | Plays the bgm. |
| stopBgm() | Stops the bgm. |
| fadeOutBgm() | Fade out bgm. |
| fadeInBgm() | Fade in bgm. |
| playBgs() | Plays the bgs. |
| stopBgs() | Stops the bgs. |
| fadeOutBgs() | Fade out bgs. |
| fadeInBgs() | Fade in bgs. |
| playMe() | Plays the me. |
| fadeOutMe() | Fade out me. |
| stopMe() | Stops the me. |
| playSe() | Plays the se. |
| stopSe() | Stops the se. |
| playStaticSe() | Plays the static se. |
| stopAll() | Stops the all. |
| saveBgm() | Saves the bgm. |
| saveBgs() | Saves the bgs. |
| resumePendingBgmSequence() | Plays the sequence that was waiting for its map, once that map is the one loaded. |
| playBgmSequence() | Plays the bgm sequence. |
| stopBgmSequence() | Stops the bgm sequence. |
| _startBgmSequenceTrack() | Starts one non-looping track for the sequence; onEnd runs when it plays out. |
| _destroyBgmSequenceBuffer() | Destroy bgm sequence buffer. |
| _startBgmSequenceEntry() | Starts the bgm sequence entry. |
| _startBgmSequencePalette() | Starts the bgm sequence palette. |
| _startBgmSequenceLayer() | Starts the bgm sequence layer. |
| _endBgmSequencePalette() | Ends the bgm sequence palette. |
| _fadeOutBgmSequence() | Fade out bgm sequence. |
Updating & Drawing 9
| updateBgmParameters() | Updates the bgm parameters each frame. |
| updateCurrentBgm() | Updates the current bgm each frame. |
| updateBgsParameters() | Updates the bgs parameters each frame. |
| updateCurrentBgs() | Updates the current bgs each frame. |
| updateMeParameters() | Updates the me parameters each frame. |
| updateSeParameters() | Updates the se parameters each frame. |
| updateBufferParameters() | Updates the buffer parameters each frame. |
| updateBgmSequence() | The per-frame step: silences end, palette layers restart, palettes fade and move on. |
| _refreshBgmSequenceVolumes() | Re-derives every live layer's volume after the BGM volume option changes. |
Other 29
| replayBgm() | Replay bgm. |
| replayBgs() | Replay bgs. |
| seVariantPool() | Every take a slot or timing can play: the SE itself, then its variants, with anything unnamed dropped. |
| rollSePitch() | A pitch inside range, or null when the range is absent or unusable. |
| cleanupSe() | Cleanup se. |
| audioFileExt() | Audio file ext. |
| checkErrors() | Check errors. |
| skipsMissingAudio() | System.json rrSkipMissingAudio (2000/2003 imports): a sound or track the game names but never shipped (often… |
| throwLoadError() | Throw load error. |
| mapBgmObject() | The BGM object a map plays: its fallback track, marked with the sequence when it has one. |
| mapHasBgmSequence() | Map has bgm sequence. |
| librarySequenceKey() | The key a library entry travels under in a BGM object. |
| librarySequenceId() | The library id a key names, or 0 when the key is a map id. |
| librarySequenceData() | A library entry's sequence, or null when id names nothing playable. |
| battleMusicBgm() | The battle music a troop or a map keeps in battleBgm, the same audio object Change Battle BGM stores. |
| troopBattleBgm() | The battle music the troop about to fight names, or null. |
| mapBattleBgm() | The battle music the current map names, or null; a battle test has no map. |
| _bgmSequenceDataFor() | The sequence a key names: a library entry, or the current map's for its id (null while that map is not loaded… |
| _bgmSequenceTrackAudio() | Bgm sequence track audio. |
| _bgmSequenceBuffers() | Bgm sequence buffers. |
| _retireBgmSequenceBuffer() | Releases a buffer the sequence has finished with. |
| _sweepBgmSequenceRetiring() | Sweep bgm sequence retiring. |
| _nextBgmSequenceEntry() | The entry that would play next, skipping any the sequence has used up -- the same walk the advance makes, wit… |
| _bgmSequenceFadeIn() | Seconds the entry wants to swell in over; 0 for one that names none. |
| _pruneBgmSequenceBuffers() | Prune bgm sequence buffers. |
| _advanceBgmSequence() | Advance bgm sequence. |
| _bgmSequenceLayerIsEnding() | Whether a layer's track is close enough to its end to hand over now. |
| _advanceIfPaletteSpent() | Moves a single-shot palette on once every layer has had its one turn. |
| _duckBgmSequence() | Duck bgm sequence. |
Setup & Creation
loadStaticSe
static sourceAudioManager.loadStaticSe(se)
Loads the static se. (Same as the RPG Maker MZ method of this name.)
makeEmptyAudioObject
static sourceAudioManager.makeEmptyAudioObject()
Makes the empty audio object. (Same as the RPG Maker MZ method of this name.)
createBuffer
static sourceAudioManager.createBuffer(folder, name)
Creates the buffer. (Same as the RPG Maker MZ method of this name.)
Getting Information
resolveSeVariant
static sourceAudioManager.resolveSeVariant(se)
The SE to actually play.
Details
The SE to actually play. Resolution sits here rather than in SoundManager so that every SE the engine plays gets it -- animation sound timings, the Play SE event command, UI and 3D effect sounds -- and not only the system sound slots, which are the only thing SoundManager is reached by.
Returns se itself when neither key is set, so the common path allocates
nothing. Otherwise it returns a fresh object: the pool entries are live
$dataSystem/$dataAnimations objects, and writing a rolled pitch back into one
would persist it on the editor's next save.
_pickBgmSequencePoolEntry
static internal sourceAudioManager._pickBgmSequencePoolEntry(layer)
The next pool entry: in order, dealt from a shuffled bag, or drawn at random.
Checks (True / False)
isCurrentBgm
static sourceAudioManager.isCurrentBgm(bgm)
Whether it is current bgm. (Same as the RPG Maker MZ method of this name.)
isCurrentBgs
static sourceAudioManager.isCurrentBgs(bgs)
Whether it is current bgs. (Same as the RPG Maker MZ method of this name.)
isMissingLocalSe
static sourceAudioManager.isMissingLocalSe(name)
A missing one-shot sound must not stop the battle or start a new failed request for every hit.
Details
A missing one-shot sound must not stop the battle or start a new failed request for every hit. Web/remote audio retains the normal loading path.
isStaticSe
static sourceAudioManager.isStaticSe(se)
Whether it is static se. (Same as the RPG Maker MZ method of this name.)
Actions
playBgm
static sourceAudioManager.playBgm(bgm, pos)
Plays the bgm. (Same as the RPG Maker MZ method of this name.)
stopBgm
static sourceAudioManager.stopBgm()
Stops the bgm. (Same as the RPG Maker MZ method of this name.)
fadeOutBgm
static sourceAudioManager.fadeOutBgm(duration)
Fade out bgm. (Same as the RPG Maker MZ method of this name.)
fadeInBgm
static sourceAudioManager.fadeInBgm(duration)
Fade in bgm. (Same as the RPG Maker MZ method of this name.)
playBgs
static sourceAudioManager.playBgs(bgs, pos)
Plays the bgs. (Same as the RPG Maker MZ method of this name.)
stopBgs
static sourceAudioManager.stopBgs()
Stops the bgs. (Same as the RPG Maker MZ method of this name.)
fadeOutBgs
static sourceAudioManager.fadeOutBgs(duration)
Fade out bgs. (Same as the RPG Maker MZ method of this name.)
fadeInBgs
static sourceAudioManager.fadeInBgs(duration)
Fade in bgs. (Same as the RPG Maker MZ method of this name.)
playMe
static sourceAudioManager.playMe(me)
Plays the me. (Same as the RPG Maker MZ method of this name.)
fadeOutMe
static sourceAudioManager.fadeOutMe(duration)
Fade out me. (Same as the RPG Maker MZ method of this name.)
stopMe
static sourceAudioManager.stopMe()
Stops the me. (Same as the RPG Maker MZ method of this name.)
playSe
static sourceAudioManager.playSe(se)
Plays the se. (Same as the RPG Maker MZ method of this name.)
stopSe
static sourceAudioManager.stopSe()
Stops the se. (Same as the RPG Maker MZ method of this name.)
playStaticSe
static sourceAudioManager.playStaticSe(se)
Plays the static se. (Same as the RPG Maker MZ method of this name.)
stopAll
static sourceAudioManager.stopAll()
Stops the all. (Same as the RPG Maker MZ method of this name.)
saveBgm
static sourceAudioManager.saveBgm()
Saves the bgm. (Same as the RPG Maker MZ method of this name.)
saveBgs
static sourceAudioManager.saveBgs()
Saves the bgs. (Same as the RPG Maker MZ method of this name.)
resumePendingBgmSequence
static sourceAudioManager.resumePendingBgmSequence()
Plays the sequence that was waiting for its map, once that map is the one loaded.
Details
Plays the sequence that was waiting for its map, once that map is the one loaded. A save being loaded asks for its music before the map is read and makes no transfer, so the map's autoplay never repeats the request.
playBgmSequence
static sourceAudioManager.playBgmSequence(bgm)
Plays the bgm sequence. (Same as the RPG Maker MZ method of this name.)
stopBgmSequence
static sourceAudioManager.stopBgmSequence()
Stops the bgm sequence. (Same as the RPG Maker MZ method of this name.)
_startBgmSequenceTrack
static internal sourceAudioManager._startBgmSequenceTrack(state, audio, onEnd, fadeIn)
Starts one non-looping track for the sequence; onEnd runs when it plays out.
_destroyBgmSequenceBuffer
static internal sourceAudioManager._destroyBgmSequenceBuffer(buffer)
Destroy bgm sequence buffer. (Same as the RPG Maker MZ method of this name.)
_startBgmSequenceEntry
static internal sourceAudioManager._startBgmSequenceEntry(state, entry)
Starts the bgm sequence entry. (Same as the RPG Maker MZ method of this name.)
_startBgmSequencePalette
static internal sourceAudioManager._startBgmSequencePalette(state, entry, now)
Starts the bgm sequence palette. (Same as the RPG Maker MZ method of this name.)
_startBgmSequenceLayer
static internal sourceAudioManager._startBgmSequenceLayer(state, layer)
Starts the bgm sequence layer. (Same as the RPG Maker MZ method of this name.)
_endBgmSequencePalette
static internal sourceAudioManager._endBgmSequencePalette(state, fadeOut)
Ends the bgm sequence palette. (Same as the RPG Maker MZ method of this name.)
_fadeOutBgmSequence
static internal sourceAudioManager._fadeOutBgmSequence(duration)
Fade out bgm sequence. (Same as the RPG Maker MZ method of this name.)
Updating & Drawing
updateBgmParameters
static sourceAudioManager.updateBgmParameters(bgm)
Updates the bgm parameters each frame. (Same as the RPG Maker MZ method of this name.)
updateCurrentBgm
static sourceAudioManager.updateCurrentBgm(bgm, pos)
Updates the current bgm each frame. (Same as the RPG Maker MZ method of this name.)
updateBgsParameters
static sourceAudioManager.updateBgsParameters(bgs)
Updates the bgs parameters each frame. (Same as the RPG Maker MZ method of this name.)
updateCurrentBgs
static sourceAudioManager.updateCurrentBgs(bgs, pos)
Updates the current bgs each frame. (Same as the RPG Maker MZ method of this name.)
updateMeParameters
static sourceAudioManager.updateMeParameters(me)
Updates the me parameters each frame. (Same as the RPG Maker MZ method of this name.)
updateSeParameters
static sourceAudioManager.updateSeParameters(buffer, se)
Updates the se parameters each frame. (Same as the RPG Maker MZ method of this name.)
updateBufferParameters
static sourceAudioManager.updateBufferParameters(buffer, configVolume, audio)
Updates the buffer parameters each frame. (Same as the RPG Maker MZ method of this name.)
updateBgmSequence
static sourceAudioManager.updateBgmSequence()
The per-frame step: silences end, palette layers restart, palettes fade and move on.
_refreshBgmSequenceVolumes
static internal sourceAudioManager._refreshBgmSequenceVolumes()
Re-derives every live layer's volume after the BGM volume option changes.
Other
replayBgm
static sourceAudioManager.replayBgm(bgm)
Replay bgm. (Same as the RPG Maker MZ method of this name.)
replayBgs
static sourceAudioManager.replayBgs(bgs)
Replay bgs. (Same as the RPG Maker MZ method of this name.)
seVariantPool
static sourceAudioManager.seVariantPool(se)
Every take a slot or timing can play: the SE itself, then its variants, with anything unnamed dropped.
rollSePitch
static sourceAudioManager.rollSePitch(range)
A pitch inside range, or null when the range is absent or unusable.
Details
A pitch inside range, or null when the range is absent or unusable. The
editor writes '' for a cleared control, which is not a zero -- Number('') is
0 and would clamp to a silent-sounding 50 rather than meaning "no range".
Clamped to 50-150 because pitch is playback rate downstream.
cleanupSe
static sourceAudioManager.cleanupSe()
Cleanup se. (Same as the RPG Maker MZ method of this name.)
audioFileExt
static sourceAudioManager.audioFileExt()
Audio file ext. (Same as the RPG Maker MZ method of this name.)
checkErrors
static sourceAudioManager.checkErrors()
Check errors. (Same as the RPG Maker MZ method of this name.)
skipsMissingAudio
static sourceAudioManager.skipsMissingAudio()
System.json rrSkipMissingAudio (2000/2003 imports): a sound or track the game names but never shipped (often a standard RTP file such as Save2) stays silent, as the old players do, instead of stopping the game on a load error.
throwLoadError
static sourceAudioManager.throwLoadError(webAudio)
Throw load error. (Same as the RPG Maker MZ method of this name.)
mapBgmObject
static sourceAudioManager.mapBgmObject(map, mapId)
The BGM object a map plays: its fallback track, marked with the sequence when it has one.
mapHasBgmSequence
static sourceAudioManager.mapHasBgmSequence(map)
Map has bgm sequence. (Same as the RPG Maker MZ method of this name.)
librarySequenceKey
static sourceAudioManager.librarySequenceKey(id)
The key a library entry travels under in a BGM object.
librarySequenceId
static sourceAudioManager.librarySequenceId(key)
The library id a key names, or 0 when the key is a map id.
librarySequenceData
static sourceAudioManager.librarySequenceData(id)
A library entry's sequence, or null when id names nothing playable.
battleMusicBgm
static sourceAudioManager.battleMusicBgm(audio)
The battle music a troop or a map keeps in battleBgm, the same audio object Change Battle BGM stores.
Details
The battle music a troop or a map keeps in battleBgm, the same audio object
Change Battle BGM stores. Its track plays; a sequence naming a playable
library entry plays that entry instead, with the track -- or the System
track, when none is set -- as the fallback. Null when it names neither.
troopBattleBgm
static sourceAudioManager.troopBattleBgm()
The battle music the troop about to fight names, or null.
mapBattleBgm
static sourceAudioManager.mapBattleBgm()
The battle music the current map names, or null; a battle test has no map.
_bgmSequenceDataFor
static internal sourceAudioManager._bgmSequenceDataFor(key)
The sequence a key names: a library entry, or the current map's for its id (null while that map is not loaded).
_bgmSequenceTrackAudio
static internal sourceAudioManager._bgmSequenceTrackAudio(entry)
Bgm sequence track audio. (Same as the RPG Maker MZ method of this name.)
_bgmSequenceBuffers
static internal sourceAudioManager._bgmSequenceBuffers()
Bgm sequence buffers. (Same as the RPG Maker MZ method of this name.)
_retireBgmSequenceBuffer
static internal sourceAudioManager._retireBgmSequenceBuffer(state, buffer, fade)
Releases a buffer the sequence has finished with.
Details
Releases a buffer the sequence has finished with. Given a fade it keeps playing, ramping down, until the sweep in updateBgmSequence destroys it -- which is what lets the next entry start over the top of this one.
_sweepBgmSequenceRetiring
static internal sourceAudioManager._sweepBgmSequenceRetiring(state, now)
Sweep bgm sequence retiring. (Same as the RPG Maker MZ method of this name.)
_nextBgmSequenceEntry
static internal sourceAudioManager._nextBgmSequenceEntry(state)
The entry that would play next, skipping any the sequence has used up -- the same walk the advance makes, without moving.
Details
The entry that would play next, skipping any the sequence has used up -- the same walk the advance makes, without moving. Asking the raw next entry would read an intro's fade to decide a hand-over the intro is not going to take.
_bgmSequenceFadeIn
static internal sourceAudioManager._bgmSequenceFadeIn(entry)
Seconds the entry wants to swell in over; 0 for one that names none.
_pruneBgmSequenceBuffers
static internal sourceAudioManager._pruneBgmSequenceBuffers(state)
Prune bgm sequence buffers. (Same as the RPG Maker MZ method of this name.)
_advanceBgmSequence
static internal sourceAudioManager._advanceBgmSequence(fadeOut)
Advance bgm sequence. (Same as the RPG Maker MZ method of this name.)
_bgmSequenceLayerIsEnding
static internal sourceAudioManager._bgmSequenceLayerIsEnding(layer, palette)
Whether a layer's track is close enough to its end to hand over now.
Details
Whether a layer's track is close enough to its end to hand over now. Measured from the buffer's own clock rather than from when playback was asked for, so a slow decode delays the hand-over with the track instead of cutting it short.
_advanceIfPaletteSpent
static internal sourceAudioManager._advanceIfPaletteSpent(state)
Moves a single-shot palette on once every layer has had its one turn.
_duckBgmSequence
static internal sourceAudioManager._duckBgmSequence(factor)
Duck bgm sequence. (Same as the RPG Maker MZ method of this name.)