Wwise SDK 2025.1.0
|
Androidオーディオのレイテンシーは、すべてのアプリケーションで常に問題となっていました。通常のレイテンシーは100ミリ秒以下ですが、一部のデバイスでは最大150 msのレイテンシーを示します。
Over the years, Google introduced the several "paths" through which audio can flow from an app to the device's audio hardware:
When supported, these paths bypass various levels of internal processing to reduce the latency between the app and the hardware. 全体的なレイテンシーは、数十ミリ秒に短縮することができます。It is important to note that it is not mandatory for the hardware manufacturers to implement these paths; many do not. Furthermore, some devices can report a fast path without it actually being implemented. Therefore, a game cannot rely on the existence of fast audio paths on the end-user's devices. ゲームが幅広いターゲット市場を対象としている場合は、この機能を使用せずにゲームオーディオを設計する必要があります。
一般に、レイテンシーが短くなるとCPU負荷が高くなります。RTPC更新、ゲームオブジェクトの位置、他のゲーム入力などの処理は、フレームごとに行われます。したがって、より小さなフレームでは、これはより頻繁に処理されます。レイテンシーとCPU使用率とのバランスは、実験を通じてのみ見つけることができます。厳しいルールはありません。
いくつかの設定は、Wwise SDKのオーディオレイテンシーを制御します:
AkPlatformInitSettings::uSampleRate
: 使用するサンプルレートWhen set to 0 (the default), the hardware preferred rate is selected, allowing use of the fast audio path.AkPlatformInitSettings::uNumRefillsInVoice
: 前処理するバッファの数。これは、CPU使用状況と中断からの保護です。AkInitSettings::uNumSamplesPerFrame
: バッファあたりのサンプル数。AkPlatformInitSettings::eAudioPath
: Which audio path to prefer based on device capabilities.AK::SoundEngine::GetDefaultSettings()
and AK::SoundEngine::GetDefaultPlatformInitSettings()
によって返されるデフォルトの設定は、ほとんどのデバイスで、ほとんどの場合" 安全" な設定です。それらを使用して設定します:
uSampleRate
をハードウェア推奨レートに設定します。これは通常48 kHzまたは44.1 kHzです。uNumSamplesPerFrame
to 512.uNumRefillsInVoice
を 4
.に設定します。AkPlatformInitSettings::eAudioPath
to AkAudioPath_LowLatency
.Advantages: This setup will select an appropriately low-latency audio path on devices that support it. また、オーディオ設計のCPU使用率に関する制約も少なくなります。
デメリット: CPUによって差があることに対応するために、オーディオの4フレーム分を事前処理しますが、このため、ヘッドルームを必要としないデバイスで、レイテンシーが大きくなることがあります。
To initialize Wwise with the lowest latency, call AK::SoundEngine::GetDefaultSettings()
and AK::SoundEngine::GetDefaultPlatformSettings()
, then apply the following changes:
AkPlatformInitSettings::uNumRefillsInVoice
to 2.AkPlatformInitSettings::eAudioAPI
to AkAudioAPI_AAudio
.AkPlatformInitSettings::eAudioPath
to AkAudioPath_Exclusive
.メリット: 最小限のレイテンシー。
デメリット:使用可能なCPUは限られます。オーディオのレンダリングに割り当てられる時間は非常に短く、システム上の他のイベントによって簡単に妨げられる可能性があります。オーディオ設計(RTPC、Switch、 Positioning、コンテナなど)のCPUオーバーヘッド(負荷)は懸念事項で、注意深くモニタリングする必要があります。Also, device compatibility is reduced. Only devices running Android 8.1 and above will have audio.
1つのオーディオフレームを処理するのに必要な時間が、CPUの許容範囲よりも低い場合に、オーディオスターベーションが発生します。この時点で、ゲームがサイレンスを出力しなければ、ポップ音やグリッチがユーザーに聞こえてしまうことがあります。
このグリッチ現象を許容できない場合は、この動作を避けるために uNumRefillsInVoice
の初期値を、絶対にオーディオスターベーションが起きないような充分に大きい値にします。uNumRefillsInVoice
は、CPU使用率の変動にいくらかの余裕を持たせるために、少なくとも3、ほとんどのゲームでは通常4に設定する必要があります。
Many Bluetooth devices cannot be low latency or use a fast audio path. In fact, to have glitchless audio with a Bluetooth device, the buffering must be a lot higher. Wwise will detect the usage of a high-latency Bluetooth headset and automatically override AkPlatformInitSettings::uNumRefillsInVoice
to reach a latency of 170 ms.