Class in reactor_managers.js

AudioManager

53 public functions in 6 groups · show internal (_) functions

The Database: everything Core loads at boot.

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 1

resolveSeVariant() The SE to actually play.

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 20

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.

Updating & Drawing 8

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.

Other 17

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.

Setup & Creation

loadStaticSe

static source
AudioManager.loadStaticSe(se)

Loads the static se. (Same as the RPG Maker MZ method of this name.)

makeEmptyAudioObject

static source
AudioManager.makeEmptyAudioObject()

Makes the empty audio object. (Same as the RPG Maker MZ method of this name.)

createBuffer

static source
AudioManager.createBuffer(folder, name)

Creates the buffer. (Same as the RPG Maker MZ method of this name.)

Getting Information

resolveSeVariant

static source
AudioManager.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.

Checks (True / False)

isCurrentBgm

static source
AudioManager.isCurrentBgm(bgm)

Whether it is current bgm. (Same as the RPG Maker MZ method of this name.)

isCurrentBgs

static source
AudioManager.isCurrentBgs(bgs)

Whether it is current bgs. (Same as the RPG Maker MZ method of this name.)

isMissingLocalSe

static source
AudioManager.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 source
AudioManager.isStaticSe(se)

Whether it is static se. (Same as the RPG Maker MZ method of this name.)

Actions

playBgm

static source
AudioManager.playBgm(bgm, pos)

Plays the bgm. (Same as the RPG Maker MZ method of this name.)

stopBgm

static source
AudioManager.stopBgm()

Stops the bgm. (Same as the RPG Maker MZ method of this name.)

fadeOutBgm

static source
AudioManager.fadeOutBgm(duration)

Fade out bgm. (Same as the RPG Maker MZ method of this name.)

fadeInBgm

static source
AudioManager.fadeInBgm(duration)

Fade in bgm. (Same as the RPG Maker MZ method of this name.)

playBgs

static source
AudioManager.playBgs(bgs, pos)

Plays the bgs. (Same as the RPG Maker MZ method of this name.)

stopBgs

static source
AudioManager.stopBgs()

Stops the bgs. (Same as the RPG Maker MZ method of this name.)

fadeOutBgs

static source
AudioManager.fadeOutBgs(duration)

Fade out bgs. (Same as the RPG Maker MZ method of this name.)

fadeInBgs

static source
AudioManager.fadeInBgs(duration)

Fade in bgs. (Same as the RPG Maker MZ method of this name.)

playMe

static source
AudioManager.playMe(me)

Plays the me. (Same as the RPG Maker MZ method of this name.)

fadeOutMe

static source
AudioManager.fadeOutMe(duration)

Fade out me. (Same as the RPG Maker MZ method of this name.)

stopMe

static source
AudioManager.stopMe()

Stops the me. (Same as the RPG Maker MZ method of this name.)

playSe

static source
AudioManager.playSe(se)

Plays the se. (Same as the RPG Maker MZ method of this name.)

stopSe

static source
AudioManager.stopSe()

Stops the se. (Same as the RPG Maker MZ method of this name.)

playStaticSe

static source
AudioManager.playStaticSe(se)

Plays the static se. (Same as the RPG Maker MZ method of this name.)

stopAll

static source
AudioManager.stopAll()

Stops the all. (Same as the RPG Maker MZ method of this name.)

saveBgm

static source
AudioManager.saveBgm()

Saves the bgm. (Same as the RPG Maker MZ method of this name.)

saveBgs

static source
AudioManager.saveBgs()

Saves the bgs. (Same as the RPG Maker MZ method of this name.)

resumePendingBgmSequence

static source
AudioManager.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 source
AudioManager.playBgmSequence(bgm)

Plays the bgm sequence. (Same as the RPG Maker MZ method of this name.)

stopBgmSequence

static source
AudioManager.stopBgmSequence()

Stops the bgm sequence. (Same as the RPG Maker MZ method of this name.)

Updating & Drawing

updateBgmParameters

static source
AudioManager.updateBgmParameters(bgm)

Updates the bgm parameters each frame. (Same as the RPG Maker MZ method of this name.)

updateCurrentBgm

static source
AudioManager.updateCurrentBgm(bgm, pos)

Updates the current bgm each frame. (Same as the RPG Maker MZ method of this name.)

updateBgsParameters

static source
AudioManager.updateBgsParameters(bgs)

Updates the bgs parameters each frame. (Same as the RPG Maker MZ method of this name.)

updateCurrentBgs

static source
AudioManager.updateCurrentBgs(bgs, pos)

Updates the current bgs each frame. (Same as the RPG Maker MZ method of this name.)

updateMeParameters

static source
AudioManager.updateMeParameters(me)

Updates the me parameters each frame. (Same as the RPG Maker MZ method of this name.)

updateSeParameters

static source
AudioManager.updateSeParameters(buffer, se)

Updates the se parameters each frame. (Same as the RPG Maker MZ method of this name.)

updateBufferParameters

static source
AudioManager.updateBufferParameters(buffer, configVolume, audio)

Updates the buffer parameters each frame. (Same as the RPG Maker MZ method of this name.)

updateBgmSequence

static source
AudioManager.updateBgmSequence()

The per-frame step: silences end, palette layers restart, palettes fade and move on.

Other

replayBgm

static source
AudioManager.replayBgm(bgm)

Replay bgm. (Same as the RPG Maker MZ method of this name.)

replayBgs

static source
AudioManager.replayBgs(bgs)

Replay bgs. (Same as the RPG Maker MZ method of this name.)

seVariantPool

static source
AudioManager.seVariantPool(se)

Every take a slot or timing can play: the SE itself, then its variants, with anything unnamed dropped.

rollSePitch

static source
AudioManager.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 source
AudioManager.cleanupSe()

Cleanup se. (Same as the RPG Maker MZ method of this name.)

audioFileExt

static source
AudioManager.audioFileExt()

Audio file ext. (Same as the RPG Maker MZ method of this name.)

checkErrors

static source
AudioManager.checkErrors()

Check errors. (Same as the RPG Maker MZ method of this name.)

skipsMissingAudio

static source
AudioManager.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 source
AudioManager.throwLoadError(webAudio)

Throw load error. (Same as the RPG Maker MZ method of this name.)

mapBgmObject

static source
AudioManager.mapBgmObject(map, mapId)

The BGM object a map plays: its fallback track, marked with the sequence when it has one.

mapHasBgmSequence

static source
AudioManager.mapHasBgmSequence(map)

Map has bgm sequence. (Same as the RPG Maker MZ method of this name.)

librarySequenceKey

static source
AudioManager.librarySequenceKey(id)

The key a library entry travels under in a BGM object.

librarySequenceId

static source
AudioManager.librarySequenceId(key)

The library id a key names, or 0 when the key is a map id.

librarySequenceData

static source
AudioManager.librarySequenceData(id)

A library entry's sequence, or null when id names nothing playable.

battleMusicBgm

static source
AudioManager.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 source
AudioManager.troopBattleBgm()

The battle music the troop about to fight names, or null.

mapBattleBgm

static source
AudioManager.mapBattleBgm()

The battle music the current map names, or null; a battle test has no map.