Audio · class

AmbisonicSoundfield

Explained in Your first game.

class AmbisonicSoundfield
import { AmbisonicSoundfield } from '@driftengine/audio';

Constructor

new

constructor(listener: AudioListenerGraph, buffer: AudioBuffer, options?: AmbisonicOptions)

Refused at construction rather than decoded wrongly.

ParameterTypeDescription
listenerAudioListenerGraph
bufferAudioBuffer
options?AmbisonicOptions
More

A buffer with the wrong channel count is a file that is not B-format, and a decoder that took the first four channels of a stereo file would produce a plausible, silent-in-two-thirds result. The house rule is fail fast and loud at init; this is init.

Methods

place

place(x: number, y: number, z: number): void

Put the speaker rig around a point — the listener's head.

ParameterTypeDescription
xnumber
ynumber
znumber
More

Called whenever the listener moves. It writes six positions and nothing else: the decode does not depend on where anybody is looking, so there is no matrix to recompute here.

follow

follow(): void

Follow the listener this field was built against. The ordinary per-frame call.

setGain

setGain(gain: number): void

How loud the whole field is, before the bus.

ParameterTypeDescription
gainnumber

start

start(when?: number): void
ParameterTypeDescription
when?number

stop

stop(): void

dispose

dispose(): void