版本

menu_open
目标平台:
Wwise SDK 2024.1.0
针对 Android 的相关信息

本页包含有关将 Wwise SDK 用于 Android 平台的特定信息。

平台要求

To use the Wwise SDK with the Android platform, you must install the Android SDK, Android SDK Tools, and Android NDK. For the required versions, refer to the appropriate version of the Android 版本说明.

备注:

  • 为了在 Android 上构建示例插件,您需要使用 ndk-build。
  • makefile 依赖 Android NDK 工具链(如 NDK_ROOT 环境变量所指)。

在 Windows 上,您可以根据所需平台和配置,使用 SDK/source/SoundEngine 文件夹中的 BuildAllAndroid.cmd 脚本(即 BuildAllAndroid.cmd armeabi-v7a debug)来构建 Android 库。这样会调用 ndk-build 及相应参数。 此脚本可在 3 种配置(Debug、Profile、Release)下构建 4 种支持的架构(v7a、x86、v8a-64 和 x86_64)。

Using the "Fast Audio Path" (low-latency)

In recent OS versions, Google introduced the "Fast Audio Path". 如果满足一些条件,这样做会旁通一些内部处理,极大地减少操作系统和硬件处理的延迟。请参阅 控制Android上的延迟 了解更多详情。

部署和加载 SoundBank

在 Android 中部署和加载 SoundBank 有三种方式:

  1. 将 SoundBank 当作 Android 应用程序包(APK)的一部分进行部署。
    在将应用程序部署至设备前,必须将 SoundBank 放入 Android NDK 工程的 assets 子文件夹,并通过 APK(或其他工具的等效过程)正常打包。为了从 APK 读取音频包文件,必须指定音频包相对于 APK 存档内标准 assets 目录的路径。为此,请调用 CAkDefaultIOHookDeferred::SetBasePath() 。此操作不会自动完成。
  2. 将 SoundBank 装入 Android Application Split Binary(又称为OBB)进行部署。 为了从 OBB 读取 SoundBank,必须确保音频包在 OBB 内的相对路径与主 APK 中的设置相同。
  3. 将 SoundBank 直接部署到 Android 设备文件系统中。 SoundBank 可部署到设备文件系统中的任何位置。You can add as many directories as you want with CAkDefaultIOHookDeferred::AddBasePath().

位于 $<Wwise>/SDK/samples/SoundEngine/Android 中的底层 I/O 的默认实现可访问 APK、OBB 和 POSIX 文件。You must call the function CAkDefaultIOHookDeferred::InitAndroidIO with a JavaVM and the android.app.Activity to initialize both APK and OBB readers.

备注: OBB 包必须解密,之后默认 Low-Level I/O 才能正常工作。否则需要编写自己的 IO。
备注: OBB 读取操作通过 libzip 执行,请检查 Libzip 下的授权。如果您不接受该授权,则可通过在编译选项中定义“REMOVE_LIBZIP”符号来禁用 LibZip。在这种情况下,您需要编写自己的 I/O hook 来读取 OBB 或在使用前解压 OBB。

IO 系统将在给定路径中逆序查找文件,先添加最新内容,最后添加 APK 内容。这样 DLC 内容便可替换 APK 内容了。

请参阅 Low-Level I/O 了解有关如何实现 Low-level I/O 子模块的信息。

Android 库特点

安装包中的 Wwise SDK 库采用以下编译方式:

  • 在 armeabi-v7a 架构上支持 NEON 指令集
  • 在 x86 架构上支持 SSE 指令集
  • 在 arm64-v8a 架构上支持 NEON 指令集
  • 在 x86_64 架构上支持 SSE 指令集

Android Audio APIs

Wwise supports the following audio APIs on Android:

3D Audio Support

Wwise 3D Audio is supported on Android. It is implemented through Android's Spatial Audio technology (distinct from Wwise Spatial Audio), and is designed for headphone output. It supports a spatialized bed and a passthrough mix. System audio objects are not supported.

Android OS versions 13 and higher have Spatial Audio user preferences for wired and wireless headphones. Therefore, the 3D Audio pipeline in Wwise is always activated when the following requirements are met:

  • The Audio Device property Allow 3D Audio is enabled in the Wwise project.
  • Spatial Audio is enabled on the device for headphones. For wireless headphones, it can be enabled in the Bluetooth settings.
  • The output device channel configuration is not set or a supported channel configuration is used (see Main Mix Configuration below).

We recommend that you allow the user to choose whether to use 3D Audio through an in-game setting, and swap between two Audio Device sharesets based on this setting.

备注: Enabling Android Spatial Audio disables the low-latency "Fast Audio Path" feature. Refer to Using the "Fast Audio Path" (low-latency)

Using 3D Audio with AAudio

Upon initialization, when using AAudio with 3D Audio activated, the main mix is configured as 7.1.4 PCM (default), unless the Main Mix Configuration property of the Audio Device is set to a different value. These are the supported main mix PCM channel configurations for use with AAudio:

  • 5.1
  • 5.1.2
  • 7.1
  • 7.1.2
  • 7.1.4 (recommended)

Using 3D Audio with OpenSL ES

Upon initialization, when using OpenSL ES with 3D Audio activated, the main mix is configured as 5.1.4 PCM (default), unless the Main Mix Configuration property of the Audio Device is set to a different value. These are the supported main mix PCM channel configurations for use with OpenSL ES:

  • 5.1
  • 5.1.2
  • 5.1.4 (recommended)
  • 7.1
  • 7.1.4

A main mix channel configuration of 5.1.4 or 7.1.4 is downmixed to 5.1.2 on supported devices. If a request for an output channel configuration cannot be fulfilled by a device, the main mix and output configurations are changed to stereo.

Configuring 3D Audio in Unreal

If you are using the Wwise Unreal Integration, you must set several options in the Unreal project to enable 3D Audio. Different speaker configurations (7.1.4, 5.1, and so on) require different configurations.

To configure Android 3D Audio options in Unreal: #- In the Unreal project, select Edit > Project Settings and in the Wwise section, select Android. The Wwise - Android settings page opens. #- Open Common Settings > Main Output Settings. #- Set the Panning Rule to Headphones. #- Set the Channel Config Type to Standard. #- Set the Channel Mask options according to the desired speaker configuration, listed in the following table:

Speaker configuration Channel Mask settings
5.1
  • Front Left
  • Front Right
  • Front Center
  • Low Frequency
  • Back Left
  • Back Right
5.1.2
  • Front Left
  • Front Right
  • Front Center
  • Low Frequency
  • Back Left
  • Back Right
  • Height Front Left
  • Height Front Right
7.1
  • Front Left
  • Front Right
  • Front Center
  • Low Frequency
  • Back Left
  • Back Right
  • Side Left
  • Side Right
7.1.2
  • Front Left
  • Front Right
  • Front Center
  • Low Frequency
  • Back Left
  • Back Right
  • Side Left
  • Side Right
  • Height Front Left
  • Height Front Right
7.1.4
  • Front Left
  • Front Right
  • Front Center
  • Low Frequency
  • Back Left
  • Back Right
  • Side Left
  • Side Right
  • Height Front Left
  • Height Front Right
  • Height Back Left
  • Height Back Right

Android 版本说明


此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅