社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

+1 投票

I am using Wwise Unity Integration Version 19, integration bundle 2019.2.6.1867, based on WwiseSDK 2019.2.6 Build 7381.

 

I have an AK.Wwise.Event that is localized for multiple languages.

I can verify that if I perform these steps:

  1. Unload the soundbank that contains the event with: AkBankManager.UnloadBank(bankName)
  2. Change the Language with:  AkSoundEngine.SetCurrentLanguage(newLangName)
  3. Wait a few frames...
  4. Re-load the soundbank with: AkBankManager.LoadBank(bankName)
  5. Finally call event.Post(...)

That the correct version plays for the language in question. So far so good


 

Now as an experiment I want to try and do this dynamically. 

Basically if the event in question is currently playing (so I have its playingID and have previously Post-ed it) and the language is changed, I want to stop the event and re-start its new localized version at the same timestamp it just left off at, effectively allowing the user to switch between languages on the fly.

 

I have a proof of concept of this working mostly, but unfortunately for some reason I randomly get WWise: Media was not loaded for this source errors. 

The basic approach:

  • I have a simple dropdown UI for testing where I can pick from all the languages I have files for in the bank under the given name. 
  • Based on user input it calls AkSoundEngine.SetCurrentLanguage(...) 
  • Since AK::StreamMgr::AddLanguageChangeObserver does not seem to be exposed do the C# API, I am detecting when the language changes by regularly checking AkSoundEngine.GetCurrentLanguage().
  • Once a change is observed, I reload the event's bank(s) using a coroutine to ensure the bank loads completely: https://gist.github.com/JohannesMP/2b6b58e5a5bce4b273c8b869aba3ead1
  • I manage my  AK.Wwise.Event with its own component that now receives the AkCallbackType.AK_EndOfEvent callback, as a result of the event being stopped since its bank was unloaded.
  • I waits a few frames to make sure the bank is definitely done loading, and then post the event again.
  • And finally we use AkSoundEngine.SeekOnEvent to set the time to where it was before the language change.

 

As mentioned, seemingly at random I will get a WWise: Media was not loaded for this source error when the event is re-posted after the soundbank finished reloading, which I cannot explain. This even happens if I extend the delays between unloading the bank, loading the bank, and re-Post-ing the event to many seconds. More curious is that once a given AK.Wwise.Event  has entered this 'error' state, I can try calling Post as many times as I want, it will continue to insist that the media is not loaded. Only by switching to a different language (which reloads the bank) and back again does it seem to recover.

 

 

So my question here is, what is causing this error, and how can I avoid it?

I'm positive it's not a matter of not waiting long enough for the bank to finish loading, and it seems to be fairly random when it happens, but seems to be more common if I switch back and forth between languages a few times.

 

 

分类:General Discussion | 用户: Johannes P. (110 分)
Did you ever get an answer to this? I'm seeing something similar with Wwise 2022.1.18.

Please sign-in or register to answer this question.

...