您的位置:首页 > 移动开发 > Unity3D

VR系列——Oculus Audio sdk文档:三、Oculus对于Unity天然的声场定位技术(1)——概述及要求和安装

2016-11-17 15:35 756 查看
  欢迎观看这个指南来使用Oculus对于Unity的天然声场定位插件!

  Welcome to this guide to using the Oculus Native Spatializer plugin in Unity!

概述(Overview)

  这个指南介绍如何安装和使用Oculus天然声场定位插件在Unity5.2+和在最终用户应用。

  This guide describes how to install and use the Oculus Native Spatializer plugin in Unity 5.2+ and in end-user

applications.

  Oculus 天然声场定位插件(ONSP)是一个Unity的附加插件,为了允许单声道声音源相对于用户头部位置来被空间化。

  The Oculus Native Spatializer Plugin (ONSP) is an add-on plugin for Unity that allows monophonic sound sources to be spatialized in 3D relative to the user’s head location.

  这天然Oculus声场定位技术是建立在Unity的天然音频插件中,移除多余的空间化逻辑并且提供第一部分的HRTF。它取代了我们以前的Oculus声场定位插件(在之前的Audio SDK1.0中可以获得),这个是使用脚本来设置一个声音源的设置。

  The Native Oculus Spatializer is built on Unity’s Native Audio Plugin, which removes redundant spatialization logic and provides a first-party HRTF. It supersedes our previous Oculus Spatializer Plugin for Unity (available prior to Audio SDK 1.0 ), which used scripts to set settings on an Audio Source.

  我们在三维空间中本地化音频源的功能是我们如何体验声音的基本部分。空间化是修改音频使之本地化的一个过程,所以相对于听者来说像是来源于具体的位置。这是在游戏和应用中产生虚拟现实存在感的关键部分。

  Our ability to localize audio sources in three-dimensional space is a fundamental part of how we experience sound. Spatialization is the process of modifying sounds to make them localizable, so they seem to originate from distinct locations relative to the listener. It is a key part of creating a sense of presence in virtual reality games and applications.

  详细讨论音频空间化和虚拟现实的音频,我们推荐在使用Oculus天然声场定位技术之前回顾我们介绍虚拟现实的音频的指南。如果你对Unity音频处理不熟悉,确保你回顾了Unity Audio guide.

  For a detailed discussion of audio spatialization and virtual reality audio, we recommend reviewing our Introduction to Virtual Reality Audio guide before using the Oculus Native Spatializer. If you’re unfamiliar with Unity’s audio handling, be sure to review the Unity Audio guide.

  注:我们之前的关于Unity的OSP现在已经可用在 Legacy Oculus Spatializer, 主要意在Unity4的使用者。

  Note: Our previous OSP for Unity is now available as the Legacy Oculus Spatializer, and is intended primarily for users of Unity 4.

要求和安装(Requirements and Setup)

要求(Requirements)

Windows 7/8

Unity5.2专业版或者个人版,或者更新的版本,可以到Unity Compatibility and Requirements查看具体我们推荐的版本号

Windows 7/8

Unity 5.2 Professional or Personal, or later. See Unity Compatibility and Requirements for details on our recommended versions

  注:ONSP不兼容unity4。Unity4下建的工程要继续使用Legacy OSP for Unity。

  Note: The ONSP is not compatible with Unity 4. Projects build with Unity 4 should continue use the Legacy OSP for Unity.

下载和安装(Download and Setup)

  注:我们推荐移除在导入新插件之前已经导入的所有OSP或者ONSP版本。查看下面的从之前的OSP升级unity Oculus 声场定位的说明。

  Note: We recommend removing any previously-imported versions of the OSP or ONSP before importing a new plugin. See Updating to Oculus Native Spatializer for Unity from previous OSP for Unity Versions below for instructions.

  下载ONSP并把它导入到unity 工程:

  To download the ONSP and import it into a Unity project:

从Oculus 下载页下载Oculus Audio SDK 插件包

获取压缩包

在Unity Editor里打开你的工程,或者创建一个新工程

选择Assets> Import Package> Custom Package….路径

选择并导入OculusNativeSpatializer.unitypackage

当导入对话框弹出时,选中所有选项然后点击导入

Download the Oculus Audio SDK Plugins package from the Oculus Downloads page.

Extract the zip.

Open your project in the Unity Editor, or create a new project.

Select Assets > Import Package > Custom Package….

Select OculusNativeSpatializer.unitypackage and import.

When the Importing Package dialog opens, leave all assets selected and click Import.

  打开本地Spatializer:

  To turn on the Native Spatializer:

在Unity Editor里进入Edit > Project Settings> Audio

在AudioManager Inspector里,选择OculusSpatializer下拉列表里的Spatializer Plugin,如下图所示。

Go to Edit > Project Settings > Audio in Unity Editor

Select Spatializer Plugin in the OculusSpatializer drop-down setting in the AudioManager Inspector panel as

shown below.

  我们建议设置DSP Buffer Size选项为Best latency,并为所支持的平台设置最小缓冲大小,降低整体的音频延迟。

  We recommend setting DSP Buffer Size to Best latency to set up the minimum buffer size for the platform that

is supported, reducing overall audio latency.



从先前的OSP为Unity更新Oculus Native Spatializer为统一的版本(Updating to Oculus Native Spatializer for Unity from previous OSP for Unity Versions)

注意你的项目在OSPMannager中使用的设置

在/Assets/OSP里用OculusSpatializerUserParams.cs代替AudioSources里 的OSPAudioSource.cs (从先前的OSP中)

为先前在OSPManager使用的混音通道中可以找到的插件效果设定适当的值,注意本地插件新添功能,所以你需要调整这些参数新的设置

通过从/Assets/OSP路径删除OSPManager*.*来删除工程里的OSPManager,除了你新添加的OculusSpatializerUserParams.cs文件

确认OculusSpatializer在Audio Manager中设置好了,并且Spatializer是有声音的。

Note the settings used in OSPManager in your project.

Replace OSPAudioSource.cs (from previous OSP) on AudioSources with OculusSpatializerUserParams.cs in

/Assets/OSP.

Set the appropriate values previously used in OSPManager in the plugin effect found on the mixer channel.

Note that the native plugin adds functionality, so you will need to adjust to this new set of parameters.

Remove OSPManager from the project by deleting OSPManager*.* from /Assets/OSP except

your newly-added OculusSpatializerUserParams.cs.

Verify that OculusSpatializer is set in the Audio Manager and that Spatialization is enabled for that voice.

  所有的函数比如播放,停止,等等,在之前的OSP中使用的都不存在了,相反,根据需要我们会使用AudioSources里的函数来启动、停止和控制音量。

  All functions such as Play, Stop, et cetera, that used to be on the previous OSP no longer exist. Instead, one uses the functions on AudioSource to start, stop and modify sounds as required.

  注:要实例化一个游戏对象既包括ONSPAudioSource.cs和AudioSource组件,在调用函数AudioSource Play()函数前,你必须调用AudioSource组件里的函数void SetParameters(ref AudioSource source)(在ONSPAudioSource中找到)。在音频流处理前要明确设置AudioSource的参数。如果你跳过了这一步,这些参数不会马上生效,并且你可能在播放开始时会听到声音小幅‘跳’。

  Note: To instantiate a GameObject which includes both ONSPAudioSource.cs and AudioSource components, you must call the function void SetParameters(ref AudioSource source)(found within ONSPAudioSource) on the AudioSource component before you call the AudioSource Play() function. This will explicitly set the AudioSource parameters before the audio stream is handled. If you skip this step, the parameters will not be immediately set, and you may hear a slight ‘jump’ at the start of playback.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐