Community Q&A

Where Wwise users help each other out!

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

How to pass FOnAkPostEventCallback struct in UE4 Wwise

+3 votes
I have recently updated to the latest Wwise and Unreal Engine versions. What I noticed is that my "PostEvent" functions were now throwing errors, because they no longer require two parameters. One of the new parameters is a reference to a struct of type "FOnAkPostEventCallback", for which visual studio says that the declaration is undefined. So what exactly am I supposed to pass into this function? Would highly appreciate a descriptive response!
asked Aug 9, 2018 in General Discussion by Marc B. (130 points)
Ditto. Please advise. In addition, please implement a deprecation/change strategy for the Ak UE4 plugin code.

PostAkEvent() is a UFunction, and deprecation metadata can be added to the UFUNCTION attribute. Perhaps with a deprecation message like, 'PostAkEventDEPRECATED() will be removed in Wwise [major.minor]. Please convert caller to use the updated PostAkEvent().', etc.

Due to limitations with UHT, we can't have UFUNCTION overloads, so perhaps AkComponent::PostAkEvent(...) could have been copied to a PostAkEventDEPRECATED(...), so that callers would at least have a way to unblock in the short term.

UFunctions
https://docs.unrealengine.com/en-us/Programming/UnrealArchitecture/Reference/Functions


FWIW: On the Unity side, they respect System.ObsoleteAttribute.


- thanks
I would also like to know this. Please could we get an official response for how to do this in C++.

1 Answer

–1 vote

Marc B., look at AkComponent.cpp for a workaround...

if you need to call a Blueprint function, you can use PostAkEventByName(), which calls PostAkEventByNameWithCallback() with the appropriate default/null args...
int32 UAkComponent::PostAkEventByName(const FString& in_EventName)

From cpp, you can call PostAkEventByNameWithCallback directly with the default/null args specified here in comments, if you want...
AkPlayingID UAkComponent::PostAkEventByNameWithCallback(const FString& in_EventName, AkUInt32 in_uFlags /*= 0*/, AkCallbackFunc in_pfnUserCallback /*= NULL*/, void * in_pUserCookie /*= NULL*/)

Whatever works for you. All roads eventually lead to AudioDevice->PostEvent().

- cheers

answered Aug 10, 2018 by Paul B. (180 points)
...