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.

+1 vote
If the user changes language setting... I need to change the VO sound bank. Unload the current one and load a new one..  but Wwise seems to ignore my load.

I mave main bank and VO bank. I first unload the VO bank using AkBank.Unload(), then change the language setting, then call HandleEvent() on AkBank script to force re-load of the new language bank

but it continues to play sounds from the old language bank.

So how do you remove and reload a new bank at run time ?   

I also tried calling initialize again on AkBankManager...  but it does not let you if there is existing instance, and it also warns not to destroy the instance if its already initialized... so how to swap a bank at runtime please ?

..update...

added some prints...  looks like UnloadBank is not unloading the bank, as when I try to reload it... it says its already loaded.  I am using the correct name to unload it. soo... how to unload it ?

..update 2...

It gets into the AkBankManager.UnloadBank() function...  then it calls Mutex.WaitOne()   which blocks the thread..  then it never seems to come back to print any prints after that (or to actually unload the Bank.

So... what to do now ?...

help appreciated.  Cheers
in General Discussion by Jon H. (160 points)
edited by Jon H.
Update... looks like Mutex gets stuck forever unless you stop all sound playing on all sound banks, even if the bank you are unloading isn't playing any audio...  that is a bug perhaps.
So call AkSoundEngine.StopAll(); before calling bankVO.UnloadBank()
Second problem now... When I call unload, it says there are 2 refs to the bank, so it removes 1 ref, and still does not unload it.  I only have one ref / one AkBank script with that bank, so not sure where the other ref is coming from.  getting closer...
solved it. AkBankManager()LoadBank() has some dodgy code regarding not unloading a bank scheduled to be unloaded. It doesn't check if the language changed!  so the solution is to Unload your bank, change language, Wait a while (until its definitely unloaded) then load the new language bank.

 

Unity3D Soln..

AkSoundEngine.StopAll();   //do this or Unload() will fail or get stuck in thread, due to a mutex function in there.

AkBankManager.UnloadBank(bankName);

AkSoundEngine.SetCurrentLanguage(newLangName);

wait a while...  // I did .25s but probably a frame or so is ok.

AkBankManager.LoadBank(bankName);     //re-load the VO bank

//don't forget to re-start any music tracks
Thank you for this.  yield return new WaitForEndOfFrame(); did it for me. Didn't need to change the language.

Please sign-in or register to answer this question.

...