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.

UE4 C++ Wwise integration

+1 vote
Hi guys,

I've been using Wwise for about 3 years so far. Mostly I worked with UE4 through Blueprints integration.
At this moment I'm trying to integrate and use Wwsie in UE4 through C++.

I've followed the documentation and completed the basics of Wwise C++ integration:

Now, I'm trying to Post Event in my "character.cpp" but I don't know how to do it. I could not find that information on Wwise documentation.
Could you help me to go through with Wwise Post Event integration in UE4 using C++?

Thank you for your time reading my question.
I'm looking forward to hearing from you.

asked Nov 2, 2020 in General Discussion by Pandemius (120 points)

1 Answer

0 votes

Hello Ara, 

How does your script look? How are you trying to post the event? 

For comparison with your script, here's an example of how you could post your Event in BeginPlay(). 

void ACustomActor::BeginPlay() {
     UAkComponent* AkComp = NewObject<UAkComponent>(this);
     RootComponent = AkComp;
     UAkGameplayStatics::PostEventByName("Play_MyEvent", this, true);

To get here, I created a new C++ class Actor and dragged it into the scene. 
Alternatively, you could post an Event like this...

void ACustomActor::BeginPlay() {
    UAkComponent* AkComp = NewObject<UAkComponent>(this);
    RootComponent = AkComp;
    FOnAkPostEventCallback nullCallback;
    UAkGameplayStatics::PostEvent(Event, this, int32(0), nullCallback);

... and then in your header file add this ... 

    // Sets default values for this actor's properties

    UPROPERTY(EditAnywhere, Category = "Wwise")
    class UAkAudioEvent* Event;

... which would create a nice Event property under Details, like this:

Let us know if this is helpful.

answered Nov 3, 2020 by Mads Maretty S. (Audiokinetic) (38,680 points)