Audio · class
AmbisonicSoundfield
Explained in Your first game.
class AmbisonicSoundfieldimport { AmbisonicSoundfield } from '@driftengine/audio';Constructor
new
constructor(listener: AudioListenerGraph, buffer: AudioBuffer, options?: AmbisonicOptions)Refused at construction rather than decoded wrongly.
| Parameter | Type | Description |
|---|---|---|
listener | AudioListenerGraph | |
buffer | AudioBuffer | |
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): voidPut the speaker rig around a point — the listener's head.
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number |
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(): voidFollow the listener this field was built against. The ordinary per-frame call.
setGain
setGain(gain: number): voidHow loud the whole field is, before the bus.
| Parameter | Type | Description |
|---|---|---|
gain | number |
start
start(when?: number): void| Parameter | Type | Description |
|---|---|---|
when? | number |
stop
stop(): voiddispose
dispose(): void