Version

menu_open
Target Platform(s):
Wwise SDK 2024.1.0
OpenHarmony-Specific Information

This page contains information that is specific to using the Wwise SDK for the OpenHarmony platform.

License Requirements

Before you can download the OpenHarmony SDK, you must first register a project (see Register a Project) to obtain a license. After your project is approved, OpenHarmony option appears in the Deployment Platforms list in the Audiokinetic Launcher.

Platform Requirements

To use the Wwise SDK with the OpenHarmony platform, you must install the HarmonyOS NEXT SDK. For the required versions, refer to the appropriate version of the OpenHarmony Release Notes.

To build the sample plug-ins on OpenHarmony, you need the CMake tool included in the HarmonyOS NEXT SDK.

OpenHarmony ABIs

The Wwise SDK precompiled libraries are compiled in the following flavor:

  • arm64-v8a

Precompiled support for other ABIs might be added in the future.

Deploying and Loading SoundBanks

There are two ways of deploying and loading SoundBanks on OpenHarmony.

Deploying SoundBanks as part of the OpenHarmony application package (HAP)

Before you build the HAP, place the SoundBanks and media files in the src/main/resources/rawfile subfolder of the OpenHarmony module that runs the sound engine. Files in this location are packaged in the HAP at build time.

Next, the application must perform the following actions in native code:

  1. Use the OpenHarmony native API to create a NativeResourceManager object.
  2. Instantiate the sample low-level I/O hook, CAkDefaultIOHookDeferred, located in the SDK/samples/SoundEngine/OpenHarmony directory.
  3. Call CAkDefaultIOHookDeferred::UseResourceManager() and pass the resource manager object created in step 1.
  4. Finally, call CAkDefaultIOHookDeferred::AddBasePath() and pass a path relative to the rawfile directory, prefixed with rawfile://. For example, if you placed SoundBanks in src/main/resources/rawfile/StreamingAssets/Wwise, specify the base path rawfile://StreamingAssets/Wwise.

Note: If you are not using the sample low-level I/O hook included in the Wwise SDK, you must implement your own I/O hook to read the packaged files using OpenHarmony's rawfile API.

Because OpenHarmony's rawfile API is read-only, base paths prefixed with rawfile:// are read-only as well. The sample low-level I/O hook never attempts to open files in write mode in these locations.

Deploying SoundBanks to the OpenHarmony POSIX file system directly

The SoundBanks can be deployed anywhere in the file system of the device. You can add as many directories as you want with CAkDefaultIOHookDeferred::AddBasePath(). Any base path not prefixed with rawfile:// is interpreted as a standard POSIX filesystem path, and files are read and written using the standard POSIX file I/O functions. Files that must be opened in write mode use these paths exclusively.

The I/O system searches for files in the specified paths in reverse order, starting with the most recently added path.

For instructions on how to implement the low-level I/O submodule, see Low-Level I/O.

Handling application lifecycle events

Audio interruptions

Wwise handles audio interruptions (such as incoming calls or alarms) automatically. Wwise suspends the sound engine during an interruption and reactivates it when the interruption ends.

Transitions to background

By default, Wwise keeps playing back audio even when the app loses focus and is hidden from view. To stop playback when the app is out of focus, call AK::SoundEngine::Suspend when the app is hidden, and AK::SoundEngine::WakeupFromSuspend when the app is shown. You can register Event listeners for these transitions from ArkTS through the Window module, or from C/C++ using the Xcomponent module.

Refer to Integration Demo Sample for an example of how to handle Xcomponent's SurfaceHide and SurfaceShow callbacks to suspend and resume the sound engine.

Using Communications on an OpenHarmony device

To ensure successful initialization of the Communications module, make sure that your application module requests the ohos.permission.INTERNET permission. When this permission is granted by the OS, the Communications module can open the proper TCP and UDP ports to allow communication with the Wwise Profiler.

For information on how to initialize the Communications module, see Initializing communications.

Using Wwise Motion on an OpenHarmony device

To ensure Wwise Motion works properly, make sure that your application module requests the ohos.permission.VIBRATE permission. When this permission is granted by the OS, Wwise Motion can vibrate the device appropriately.

Note that OpenHarmony device vibration capabilities are very coarse and do not permit fine-tuned, high-resolution haptic feedback. On this platform, Wwise Motion is best used for fixed-intensity rumble effects and short-lived UI haptic feedback pulses.

OpenHarmony Release Notes


Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise