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.

PostAkEvent from C++ in UE4 - Why are there two parameters?

+2 votes

int32 UAkComponent::PostAkEvent( class UAkAudioEvent * AkEvent, const FString& in_EventName )

{

return PostAkEventByName(GET_AK_EVENT_NAME(AkEvent, in_EventName));

}

This function has two parameters AkEvent and in_EventName. I don't understand it, whats the point of defining event string if you already gave event object to function, and viceversa?

asked Mar 14, 2018 in General Discussion by Nikola L. (140 points)
This is quite the discussion here at the moment. Anyone have any answers on this?
You can either pass the event using a pointer to a valid UAkAudioEvent instance, or it will read the event name from the second parameter and use that instead.

You only have to provide one parameter. Use either:

PostAkEvent(MyEvent, FString());

or:

PostAkEvent(nullptr, TEXT("My Event"))

It may be like this for backward compatibility reasons, not sure. It is definitely confusing.

1 Answer

–3 votes
Event Name is an OUT PARAMETER! it will give YOU the Event Name you dont need to submit the FString
answered Jul 13, 2020 by Alexis S. (90 points)
You are incorrect. The string is passed as a const ref. When you dig into what happens later, you'll discover both the event and the event name are passed into a GET_AK_EVENT_NAME macro which either extracts the name from the event pointer, or uses the fstring if the pointer is nullptr.
...