[page:Object3D] →

# [name]

[name] 用一个虚拟的[link:https://developer.mozilla.org/de/docs/Web/API/AudioListener listener]表示在场景中所有的位置和非位置相关的音效.
一个three.js程序通常创建一个[name]. 它是音频实体构造函数的必须参数，比如 [page:Audio Audio] and [page:PositionalAudio PositionalAudio].
大多数情况下, listener对象是camera的子对象. Camera的3D变换表示了listener的3D变换.

## 示例

[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 THREE.AudioListener(); camera.add( listener ); // create a global audio source var sound = new THREE.Audio( listener ); // load a sound and set it as the Audio object's buffer var audioLoader = new THREE.AudioLoader(); audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { sound.setBuffer( buffer ); sound.setLoop(true); sound.setVolume(0.5); sound.play(); });`

## 构造函数

### [name]( )

创建一个新的AudioListener.

## 属性

### [property:AudioContext context]

[page:AudioListener listener]构造函数中的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].

### [property:GainNode gain]

使用[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain AudioContext.createGain]()创建 [link:https://developer.mozilla.org/en-US/docs/Web/API/GainNode GainNode].

### [property:AudioNode filter]

默认为*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*.

## 方法

### [method:GainNode getInput]()

返回[page:AudioListener.gain gainNode].

### [method:AudioListener removeFilter]()

设置[page:AudioListener.filter filter]属性为*null*.

### [method:AudioNode getFilter]()

返回[page:AudioListener.filter filter]属性的值.

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

设置[page:AudioListener.filter filter] 属性的值.

### [method:Float getMasterVolume]()

返回音量.

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

设置音量.

## 源码

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]