Audio Listener 音频侦听器

优质
小牛编辑
139浏览
2023-12-01

The Audio Listener acts as a microphone-like device. It receives input from any given Audio Source in the scene and plays sounds through the computer speakers. For most applications it makes the most sense to attach the listener to the Main Camera. If an audio listener is within the boundaries of a Reverb Zone reverberation is applied to all audible sounds in the scene. (PRO only) Furthermore, Audio Effects can be applied to the listener and it will be applied to all audible sounds in the scene.

音频监听器扮演着像麦克风这样的设备。它接收任何在场景输入的音频源(Audio Source),并通过计算机的扬声器播放声音。对于大多数应用程序,经常会把侦听器贴在主摄像头(Main Camera)。如果一个音频侦听器在混响区(Reverb Zone )内,混响会应用到在场景中所有能听到的声音。(只在专业版)此外,音频效果(Audio Effects ),可以应用到侦听器,它将被应用到场景中的所有听得见的声音。

Audio Listener 音频侦听器
The Audio Listener, attached to the Main Camera
音频侦听器(Audio Listener)贴到主摄像机

Properties 属性

The Audio Listener has no properties. It simply must be added to work. It is always added to the Main Camera by default.

音频监听器没有属性。它必须被添加才能使用。它总是默认地添加到主照相机。

Details 详情

The Audio Listener works in conjunction with Audio Sources, allowing you to create the aural experience for your games. When the Audio Listener is attached to a GameObject in your scene, any Sources that are close enough to the Listener will be picked up and output to the computer's speakers. Each scene can only have 1 Audio Listener to work properly.

音频侦听器(Audio Listener)配合音频源(Audio Sources),让你可以为你的游戏创建听觉体验。当音频监听器贴在场景中的一个游戏对象,任何音频源,如果足够接近侦听器就会被获取并输出到计算机的扬声器。每个场景只能有1个音频侦听器正常工作。

If the Sources are 3D (see import settings in Audio Clip), the Listener will emulate position, velocity and orientation of the sound in the 3D world (You can tweak attenuation and 3D/2D behavior in great detail in Audio Source) . 2D will ignore any 3D processing. For example, if your character walks off a street into a night club, the night club's music should probably be 2D, while the individual voices of characters in the club should be mono with their realistic positioning being handled by Unity.

如果音频源是3D( 见音频剪辑(Audio Clip)中的导入设置(import settings)),侦听器将模拟在3D世界声音的位置,速度和方向(你可以调整衰减和3D/2D行为,这在音频源( Audio Source)有非常详细的介绍)。 2D将忽略任何3D处理。例如,如果你的人物在街道行走,走进夜总会,夜总会的音乐也许应该是二维的,而人物在俱乐部内独立的声音,应该是伴随着他们真实定位的单声道在Unity中处理。

You should attach the Audio Listener to either the Main Camera or to the GameObject that represents the player. Try both to find what suits your game best.

你应该将音频监听器贴在主相机(Main Camera)或代表玩家的游戏对象(GameObject)。都试一下,找到最适合你的游戏的那种。

Hints 提示

  • Each scene can only have one Audio Listener.
    每个场景只能有一个音频监听器。
  • You access the project-wide audio settings using the Audio Manager, found in the Edit->Project Settings->Audio menu.
    您可以使用音频管理器(Audio Manager),在菜单栏通过Edit->Project Settings->Audio访问项目范围内的音频设置。
  • View the Audio Clip Component page for more information about Mono vs Stereo sounds.
    查看音频剪辑(Audio Clip )组件页,了解更多关于单声道与立体声声音的信息。