Audio · function

addReverbZone

Register a space. Its convolver is built here and never on entry.

Explained in Your first game.

function addReverbZone(listener: AudioListenerGraph, name: string, shape: ZoneShape, options: ZoneOptions): ReverbZone
import { addReverbZone } from '@driftengine/audio';

Parameters

ParameterTypeDescription
listenerAudioListenerGraph
namestring
shapeZoneShape
optionsZoneOptions

In depth

Building an impulse allocates a stereo buffer and fills it sample by sample, which costs milliseconds; doing that when a player crosses a threshold would put both the allocation and the cost on the input path at the exact moment something is supposed to happen. graph.ts already refuses to do it on a jump for the same reason.

The return is parented to master, so a zone's tail goes through the master filter. That is deliberately unlike the three legacy returns, which join downstream of it: those carry the score, and a score is not in the world. A zone is the world, and the master filter is what "under water" means for it — a room whose tail stayed bright while everything else muffled would read as the reverb having come from somewhere else.