Version

    Autre Documentation

menu_open
Wwise SDK 2018.1.11

◆ LoadBank() [4/8]

AKRESULT __cdecl AK::SoundEngine::LoadBank ( const void *  in_pInMemoryBankPtr,
AkUInt32  in_uInMemoryBankSize,
AkMemPoolId  in_uPoolForBankMedia,
AkBankID out_bankID 
)

Loads a bank synchronously (from in-memory data, out-of-place).
NOTE: Banks loaded from in-memory with out-of-place data must be unloaded using the standard UnloadBank function (with no memory pointer). Make sure you are using the correct UnloadBank(...) overload

Use this overload when you want to manage I/O on your side. Load the bank file in a buffer and pass its address to the sound engine, the media section of the bank will be copied into the specified memory pool.

In-memory loading is out-of-place: the buffer can be release as soon as the function returns. The advantage of using this over the in-place version is that there is no duplication of bank structures. A bank load request will be posted, and consumed by the Bank Manager thread. The function returns when the request has been completely processed.

Returns
The bank ID, which is stored in the first few bytes of the bank file. You may use this ID with UnloadBank().
  • AK_Success: Load or unload successful.
  • AK_InsufficientMemory: Insufficient memory to store bank data.
  • AK_BankReadError: I/O error.
  • AK_WrongBankVersion: Invalid bank version: make sure the version of Wwise that you used to generate the SoundBanks matches that of the SDK you are currently using.
  • AK_InvalidFile: File specified could not be opened.
  • AK_InvalidParameter: Invalid parameter, invalid memory alignment.
  • AK_Fail: Load or unload failed for any other reason. (Most likely small allocation failure)
Remarks
  • The initialization bank must be loaded first.
  • All SoundBanks subsequently loaded must come from the same Wwise project as the initialization bank. If you need to load SoundBanks from a different project, you must first unload ALL banks, including the initialization bank, then load the initialization bank from the other project, and finally load banks from that project.
  • Codecs and plug-ins must be registered before loading banks that use them.
  • Loading a bank referencing an unregistered plug-in or codec will result in a load bank success, but the plug-ins will not be used. More specifically, playing a sound that uses an unregistered effect plug-in will result in audio playback without applying the said effect. If an unregistered source plug-in is used by an event's audio objects, posting the event will fail.
  • The memory must be aligned on platform-specific AK_BANK_PLATFORM_DATA_ALIGNMENT bytes (see AkTypes.h).
  • (XboxOne only): If the bank may contain XMA in memory data, the memory must be allocated using the Physical memory allocator.
  • Requesting to load a bank in a different memory pool than where the bank was previously loaded must be done only after receiving confirmation by the callback that the bank was completely unloaded or by using synchronous versions of the UnloadBank function.
  • Avoid using this function for banks containing a lot of events or structure data.

    This data will be loaded in the Default Pool anyway thus duplicating memory (one copy in the Default Pool and one in the block you provided). For event/structure-only banks, prefer the other versions of LoadBank().

See also
Parameters
in_pInMemoryBankPtr Pointer to the in-memory bank to load (pointer is not stored in sound engine, memory can be released after return)
in_uInMemoryBankSize Size of the in-memory bank to load
in_uPoolForBankMedia Memory pool to copy the media section of the bank to (the pool is created if AK_DEFAULT_POOL_ID is passed).
out_bankID Returned bank ID

Cette page a-t-elle été utile ?

Besoin d'aide ?

Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !

Visitez notre page d'Aide

Décrivez-nous de votre projet. Nous sommes là pour vous aider.

Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !

Partir du bon pied avec Wwise