Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes

Hello,

I'm trying to understand the behavior of Wwise when calling SoundEngine functions on a global callback on, say the AkGlobalCallbackLocation_Begin location, and I have a bunch of questions:

In my callback, if I call AK::SoundEngine::PostEvent(), will that Event trigger on that same update? The callback is in the event thread, so does the system know to enqueue it and process it immediately? I see that the callback includes an AK::IAkGlobalPluginContext pointer, which has a PostEventSync() function. Should I use that instead? Will there be any difference between them in this case?

What about other calls, such as SoundEngine::SetRTPCValue(), SoundEngine::SetSwitch(), or SoundEngine::SetState()? The global plugin context has an SetRTPCValue() function. Is that synchronous like PostEventSync()? Should I prefer calling that function from the global callback? There's no equivalent for SetSwitch() and SetState(), so what is the behavior there? Will the changes get processed in the current frame?

Similar question for GameObject-related functions: will AK::SoundEngine::SetPosition() work correctly when called from a global callback, and will it execute that same frame?

Are there any SoundEngine functions that I should avoid calling from a global callback?

Thank you!

(We're currently using Wwise 2024.1.)

in General Discussion by Guy Somberg (130 points)

1 Answer

0 votes
 
Best answer

Hello Guy,

 

The developers suggest that you review the ````CAkAudioMgr::DoUpdateAndRenderIterationAsync definition in the sound engine code.

 

You are looking for:

AkGlobalCallbackLocation_PreProcessMessageQueueForRender

AkGlobalCallbackLocation_PostMessagesProcessed

 

The first one will allow you to have the Event trigger in the same update, the latter will defer it to the next audio tick/frame.

 

We do not think any sound engine functions should be avoided in a global callback (aside from obvious recursive ones like "call synchronous Render Audio").
 

I hope this helps!

Guillaume


 

by Guillaume R. (Audiokinetic) (11.6k points)
selected by Alessandro Famà
Thank you!  This is very helpful and is guiding me in the right direction.
...