arrow_right Table des matières

Autre Documentation

Wwise SDK 2018.1.11

◆ LoadBank() [5/8]

AKRESULT __cdecl AK::SoundEngine::LoadBank ( const char *  in_pszString,
AkBankCallbackFunc  in_pfnBankCallback,
void *  in_pCookie,
AkMemPoolId  in_memPoolId,
AkBankID out_bankID 

Loads a bank asynchronously.
The bank name is passed to the Stream Manager. Refer to General Information for a discussion on using strings and IDs. You can specify a custom pool for storage of media, the engine will create a new pool if AK_DEFAULT_POOL_ID is passed. A bank load request will be posted to the Bank Manager consumer thread. The function returns immediately.

AK_Success if the scheduling was successful, AK_Fail otherwise. Use a callback to be notified when completed, and get the status of the request. The bank ID, which is obtained by hashing the bank name (see GetIDFromString()). You may use this ID with UnloadBank().
  • 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 sound engine internally calls GetIDFromString(in_pszString) to return the correct bank ID. Therefore, in_pszString should be the real name of the SoundBank (with or without the BNK extension - it is trimmed internally), not the name of the file (if you changed it), nor the full path of the file. The path should be resolved in your implementation of the Stream Manager (AK::IAkStreamMgr::CreateStd()), or in the Low-Level I/O module (AK::StreamMgr::IAkFileLocationResolver::Open()) if you use the default Stream Manager's implementation.
  • The cookie (in_pCookie) is passed to the Low-Level I/O module for your convenience, in AK::StreamMgr::IAkFileLocationResolver::Open() - 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.
See also
in_pszString Name/path of the bank to load
in_pfnBankCallback Callback function
in_pCookie Callback cookie (reserved to user, passed to the callback function, and also to AK::StreamMgr::IAkFileLocationResolver::Open() as AkFileSystemFlags::pCustomParam)
in_memPoolId Memory pool ID (the pool is created if AK_DEFAULT_POOL_ID is passed)
out_bankID Returned bank ID