Wwise SDK 2024.1.1
|
All modules of the Wwise sound engine access memory through the AK::MemoryMgr interface. The client of the sound engine is responsible for initializing and terminating this interface.
A default implementation is provided with the SDK as a static library (AkMemoryMgr.lib). To use this library, the client needs to include the AkModule.h header, and call the AK::MemoryMgr::Init initialization function.
Refer to Build Configuration for more information regarding the usage of AkMemoryMgr.lib and other libraries.
In the default implementation, default initialization settings can be obtained using 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.
Note: Profiling of AkMemoryArenas in Wwise is not available when using a custom memory allocator. |
Use the following setting to enable additional runtime debugging functionality:
This is an opaque value to allow custom implementations to define as many memory debugging features as they like. The default implementation provides two levels.
Use the following to dump all allocations to a file (note that this requires AkMemSettings::uMemoryDebugLevel to be 1 and a non Release configuration):
Remark: The sound engine opens a stream for writing using AK::IAkStreamMgr::CreateStd(). If you are using the default implementation of the Stream Manager, file opening is executed in your implementation of the Low-Level IO interface 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.
For more information, refer to the following sections:
It is possible for a client to provide a custom implementation of the AK::MemoryMgr interface. All functions defined in AkMemoryMgr.h should be implemented. The functions from the AK::MemoryMgr namespace defined in AkModule.h do not need to be implemented as they are specific to the default implementation of the memory manager.
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. Device memory allocation is used on certain platforms only, and must conform to specific parameters: refer to the platform-specific section for details.
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'AideEnregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise