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 (method 4) looks for wrong loose media

0 votes

Wwise SDK 2016.1.1.5823

Following Method 4 in "Strategies for Managing SoundBanks", I am unable to successfully prepare media.  I have done the following:

Create new sounds, events, game-syncs, and a new soundbank.  Uncheck the "Media" checkbox for the sound bank.  Generate banks and it comes up with many errors about "media referenced by ... not found in any SoundBank", this should be fine.  The media files still end up as new loose .WEM files in the output directory.

I load my new 'Events & Structures'-only bank at startup so that the events can be located.  I then initiate a call to PrepareEvent on one of the events in that bank.

At this point, I hit a breakpoint in my AK::StreamMgr::IAkFileLocationResolver::Open(AkFileID, AkOpenMode, AkFileSystemFlags*, bool&, AkFileDesc&) override.  The parameters passed don't seem to be correct.

First off, the AkFileID is wrong.  It's not the ID for any of the .WEM files, but instead it's the ID of the soundbank that I created.  I found that ID in SoundbanksInfo.xml.

Secondly, the AkFileSystemFlags passed has uCodecID == AKCODECID_BANK.  In both AkFileLocationResolver example code, and our own implementation, this is used to determine if we sprintf the AkFileID to "%u.bnk" or "%u.wem".  This is making it look for a .bnk, not a .wem.

As a result, this incorrect file information coming through the file resolver causes low-level file size/open operations to fail and no media is ever loaded.

Are there any intermediate steps, either in code, or authoring that need to be done in addition to the setup described here?  While the documentation doesn't give step-by-step, I think I followed the information fairly accurately, but what I'm seeing is that preparing my event stored in a no-media bank seems to cause Wwise to ask for a BNK file, when it should be looking for several loose-media WEM files.

Thanks,

Eric

asked Oct 16, 2017 in General Discussion by Eric P. (100 points)
I have come across this as well. My .bnk file is already loaded through different methods then passed to Wwise. There should be no need for the Wwise to hit the disk again for this. In our case this fails because we don't have loose .bnk files in our packaged builds.

Eric, did you manage to solve this? We're on Wwise 2016.2.4 and this is still an issue.
Hi Jon,

Yes, I was able to debug this further and it came down to the specific overload of AK::SoundEngine::LoadBank that we were using.  I suspect you may be using the same.  The one we use to load banks is this one:

https://www.audiokinetic.com/library/edge/?source=SDK&id=namespace_a_k_1_1_sound_engine_ac89797e873ca78fd0256c91720eca65c.html

So we get the file size and allocate some memory ahead of time, then pass the address and size to the LoadBank function.  After a long support thread with Audiokinetic the realization was that using this form of LoadBank affects how media is looked up later.  They said they would fix the docs, but I'm not certain if they did.  We did some tests with sample code and prepare events worked as they should.  The only difference was the LoadBank api.

tl;dr - Use the forms of LoadBank where you pass in an AkBankID or name if you want prepare events to work.

Eric
Thanks Eric. You're absolutely correct, we are also using the same LoadBank method as you were. Switching this out for this LoadBank variant fixed it for us;

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

Thank you so much for your speedy reply. I didn't realise this LoadBank method existed, so the fix also saved us some memory!

Please sign-in or register to answer this question.

...