Wwise SDK 2024.1.1
|
Wwiseサウンドエンジンのすべてのモジュールは、AK::MemoryMgr インターフェイスを介してメモリにアクセスします。サウンドエンジンクライアントによって、このインターフェイスの初期化および終了が行われます。
デフォルト実装は、静的ライブラリ(AkMemoryMgr.lib)としてSDKで提供されています。このライブラリを使うには、クライアントは、 AkModule.h ヘッダを含めて、 AK::MemoryMgr::Init の初期化関数をコールする必要があります。
AkMemoryMgr.libとその他ライブラリの使用に関する詳細は ビルド構成 を参照してください。
デフォルト実装では、デフォルトの初期化設定を AK::MemoryMgr::GetDefaultSettings を使い取得できます。
By default, all memory is allocated by Wwise using the built-in AkMemoryArenas, each of which can be configured separately using the AkMemSettings::memoryArenaSettings
array. There are up to four AkMemoryArenas that can be configured:
AkMemoryMgrArena_Primary
: The default AkMemoryArena used by most memory categories.AkMemoryMgrArena_Media
: The AkMemoryArena used for memory allocations that go to the Media memory category, usually from loading SoundBanks.AkMemoryMgrArena_Profiler
: The AkMemoryArena used for memory allocations that go to the Profiler and Monitor Queue memory categories. This AkMemoryArena does not exist in the Release build configuration.AkMemoryMgrArena_Device
: The AkMemoryArena used for handling any device-specific memory allocations. This is present only on specific platforms that use device-specific memory for audio processing, that is, any platform that has AK_DEVICE_MEMORY_SUPPORTED
defined.We recommend you implement the following callbacks for each of the AkMemoryArenas, for integration into a game engine, as they are used by the AkMemoryArena to acquire and release spans of memory as needed.
AkMemoryArenaSettings::fnMemAllocSpan
AkMemoryArenaSettings::fnMemFreeSpan
AkMemoryArenaSettings::uMemReservedLimit
is also available to set limits on how much memory is reserved by each AkMemoryArena.
Refer to Configuration and Tuning of AkMemoryArenas for information on other settings available for configuring the AkMemoryArena.
To override the use of AkMemoryArena and use a custom allocator for every memory allocation, provide overrides of all of these callbacks:
It is important for the allocation functions above to honor the AkMemType_Device
bit by returning device memory when the bit is set.
注釈: Profiling of AkMemoryArenas in Wwise is not available when using a custom memory allocator. |
追加のランタイムデバグ機能を有効にするには、以下の設定を使います:
これは、カスタム実装で、好きなだけのメモリデバグ機能を定義できるようにする不透明な値です。デフォルトの実装で、2つのレベルが提供されます。
全てのアロケーションをファイルにダンプするには、以下を使います(必ず、 AkMemSettings::uMemoryDebugLevel を1として、Releaseコンフィギュレーションでないものを使ってください):
備考: サウンドエンジンが、 AK::IAkStreamMgr::CreateStd() を使って書き込み用のストリームを開きます。Stream Managerのデフォルト実装を使用している場合は、ファイルを開く処理は、Low-Level IOインターフェースの AK::StreamMgr::IAkLowLevelIOHook::BatchOpen() を実装した時に実行されます。
Use the following settings to perform tracking of allocations for debugging purposes (these are not called in the Release configuration):
The debug functions above do not replace the allocation functions; they are notification callbacks for the various memory allocation events.
詳細については、以下のセクションを参照してください:
クライアントは、 AK::MemoryMgr のインターフェースのカスタム化された実装を提供することができます。 AkMemoryMgr.h で定義されている関数は、すべて実装してください。 AkModule.h で定義された AK::MemoryMgr ネームスペースの関数は、メモリマネージャのデフォルト実装のためのものなので、実装する必要はありません。
As when overriding the various allocation functions of AkMemSettings
, when writing a new AK::MemoryMgr implementation care must be taken to honor the AkMemType_Device
bit by returning device memory when the bit is set. デバイスのメモリアロケーションは、一部のプラットフォームでしか使われていなく、具体的なパラメータに準拠する必要があるので、詳しくはプラットフォーム別のセクションを参照してください。