Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

PrepareEvent fails to load media

+1 vote

We have integrated Wwise for UE4 v2015.1.2 build 5457.

I am attempting to play a sound Event through the PostEvent functionality.

The Sound bank that contains the Event is not loaded upon startup. I successfully load the sound bank by use of:

PrepareBank(Preparation_Load, BankName, Structure_Only), this returns AK_Success.

I then attempt to load the media of the Event by using:

PrepareEvent(Preparation_load, EventName), this returns AK_Fail; Error: Cannot open file: <file_num>

I am also creating a PrepareEventMemoryPool upon Initialization of AK:

initSettings.uPrepareEventMemoryPoolID = AK::MemoryMgr::CreatePool(NULL, 40 * 1024 * 1024, 1024, AkMalloc);

 // (Optional) Give the memory pool a name. This can be very useful for profiling.
  AK::MemoryMgr::SetPoolName(initSettings.uPrepareEventMemoryPoolID, L"EventPool");

Am I doing something wrong in PrepareBank or PrepareEvent? I feel that I have followed the documentation on the site yet it fails.

If I fully load the Sound Bank then I am able to play the Sound just fine.

Any help would be greatly appreciated.

asked Oct 28, 2015 in General Discussion by Kartik S. (200 points)
I am also struggling with this now.  I feel like I understand how this should work, and have been following the code examples, but every time I try to prepare an event (after either Loading or Preparing the requisite bank with the metadata), it fails, claiming it can't find the media file, even though the excluded media file is in the same directory as the bank itself, right there in the default generated bank path.

I'm not seeing anywhere to specify where it should look for the media files to load, all I can do is tell Wwise where to copy them when I generate banks.  And none of the documentation mentions where the media should be put, or where I should specify a directory.

It seems to be loading the events fine, since when I call a stop event with no media required, no errors pop up.  All I'm getting in the profiler is: File not found: <name of the file I'm staring directly at right there where I assume it should be>

1 Answer

0 votes
Kartik,

In order to use PrepareEvent, media files must be excluded from soundbanks to become loose. The details on how to do this can be found in method 4 of the "Wwise Bank Management Samples" doc:

https://www.audiokinetic.com/library/2015.1.2_5457/?source=SDK&id=sdk__bank__training.html
answered Oct 29, 2015 by Adrien L. (Audiokinetic) (1,080 points)
I saw that, but then when I was reading the PrepareBank information and it seemed very explicit that by using PrepreBank with PrepareEvent both media and MetaData could be held within the same bank and used as I described in my question.

Is my understanding of PrepareBank incorrect?

Also from Medthod 4:
    Note: Since 2008.4, it is also possible to prepare events in combination with AK::SoundEngine::PrepareBank. The main advantage of using the PrepareBank mechanism is that it removes the need to split the banks into "Event banks" and "Media banks". Under this method, all content is contained in the same bank, but when AK::SoundEngine::PrepareBank is called, only the metadata content of the bank is loaded into memory. When the media is required by your game, you can load it using prepare events. See: Preparing Banks

https://www.audiokinetic.com/library/2015.1.2_5457/?source=SDK&id=soundengine__banks__loading.html#soundengine_banks_preparingbanks

AkBankContent_StructureOnly
There may be circumstances where you want to take advantage of the memory savings of the prepare event mechanism, but don't want to split up the media and metadata into separate banks. In cases like this, you can prepare your banks using AkBankContent_StructureOnly. When using this method, all content types are included in the same bank, but when AkBankContent_StructureOnly is called, only the event and structure metadata is loaded. The media within the bank is loaded on demand by preparing each event only when required.
It looks like this section of the documentation has not been updated. Thank you for pointing this out.

AkBankContent_StructureOnly cannot be used to split banks for prepareEvent anymore given that media files now have to be excluded since 2015.1.

"PrepareBank(), when called with the flag AkBankContent_StructureOnly, requires additional calls to PrepareEvent() to load the media for each event. PrepareEvent(), however, is unable to access media content contained within SoundBanks and requires that the media be available as loose files in the file system. This flag may be useful to implement multiple loading configurations; for example, a game may have a tool mode that uses PrepareEvent() to load loose files on-demand and, also, a game mode that uses LoadBank() to load the bank in entirety."

https://www.audiokinetic.com/library/2015.1.2_5457/?source=SDK&id=namespace_a_k_1_1_sound_engine_a34ba5b95a8513c29fe48be47698366e9.html
...