Skip to main content
Version: 0.2.0

Renderer

The Renderer class acts as the main DSP backend and is usually created by the Manager. It subclasses the WebAudio API's AudioNode so it can be easily connected to other nodes in the context.

It holds the global rendering parameters (see Going Further), the listener, and all created input sources.

danger

Do not construct the renderer by yourself, but use the Manager class to create an instance of it.

Public Interface

Properties

externalizer: ExternalizerParameters

Parameters to control the externalizer settings (see ExternalizerParameters).


reverb: ReverbParameters

Parameters to control the global reverb settings (see ReverbParameters).


attenuationCurve: AttenuationCurve

Global AttenuationCurve of the renderer, controlling the distance-to-gain conversion for sources relative to the listener.


listener: Listener

Listener instance of the renderer.


Methods

createSource(): Source

Creates a Source and adds it to the rendering. Use the returned instance to set its position and properties, and provide its audio input.

Throws an error if all source slots are already in use.


removeSource(source: Source): void

Disconnects the provided source from the renderer and frees up its used slot.

danger

Do not use the source after removing it from the renderer.


getListener(): Listener

Returns the renderer's Listener instance.


getListenerRelativeSourcePositions(): Array<Point3D>

Returns an array with the listener-relative source positions.

The length of the array will be the number of sources the renderer is able to hold (see Manaeger.createRenderer). Unused source slots will be empty.


getSourceDistances(): Array<number>

Returns absolute distances from the connected sources to the listener.

The length of the array will be the number of sources the renderer is able to hold (see Manaeger.createRenderer). Unused source slots will be empty.