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.

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

–2 votes
Event Name is an OUT PARAMETER! it will give YOU the Event Name you dont need to submit the FString
answered Jul 13 by Alexis S. (100 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.
...