[page:Object3D] →

[name]

The [name] represents a virtual [link:https://developer.mozilla.org/de/docs/Web/API/AudioListener listener] of the all positional and non-positional audio effects in the scene.
A Verge3D application usually creates a single instance of [name]. It is a mandatory construtor parameter for audios entities like [page:Audio Audio] and [page:PositionalAudio PositionalAudio].
In most cases, the listener object is a child of the camera. So the 3D transformation of the camera represents the 3D transformation of the listener.

Example

[example:webaudio_sandbox webaudio / sandbox]
[example:webaudio_timing webaudio / timing]
[example:webaudio_visualizer webaudio / visualizer]

// create an AudioListener and add it to the camera var listener = new v3d.AudioListener(); camera.add(listener); // create a global audio source var sound = new v3d.Audio(listener); // load a sound and set it as the Audio object's buffer var audioLoader = new v3d.AudioLoader(); audioLoader.load('sounds/ambient.ogg', function(buffer) { sound.setBuffer(buffer); sound.setLoop(true); sound.setVolume(0.5); sound.play(); });

Constructor

[name]()

Create a new AudioListener.

Properties

[property:AudioContext context]

The [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext] of the [page:AudioListener listener] given in the constructor.

[property:GainNode gain]

A [link:https://developer.mozilla.org/en-US/docs/Web/API/GainNode GainNode] created using [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain AudioContext.createGain]().

[property:AudioNode filter]

Default is *null*.

[property:Number timeDelta]

Time delta value for audio entities. Use in context of [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/linearRampToValueAtTime AudioParam.linearRampToValueAtTimeDefault](). Default is *0*.

Methods

[method:GainNode getInput]()

Return the [page:AudioListener.gain gainNode].

[method:AudioListener removeFilter]()

Set the [page:AudioListener.filter filter] property to *null*.

[method:AudioNode getFilter]()

Returns the value of the [page:AudioListener.filter filter] property.

[method:AudioListener setFilter]([param:AudioNode value])

Set the [page:AudioListener.filter filter] property to *value*.

[method:Float getMasterVolume]()

Return the volume.

[method:AudioListener setMasterVolume]([param:Number value])

Set the volume.

[sourceHint]