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.

+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:

https://www.audiokinetic.com/fr/library/edge/?source=UE4&id=using_cpp.html
also:
https://alessandrofama.com/tutorials/wwise-ue4/integration-setup
https://alessandrofama.com/tutorials/wwise-ue4/events/#Posting_Wwise_Events_by_writing_C_code_in_Unreal_Engine_4

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.

Sincerely,
Ara
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() {
     Super::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() {
    Super::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 ... 

public:
    // Sets default values for this actor's properties
    ACustomActor();

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

... which would create a nice Event property under Details, like this: 
https://drive.google.com/file/d/1U2hfz9LBEkBbJ1O0vQnHskc4T2_0Dq_h/view?usp=sharing

Let us know if this is helpful.

by Mads Maretty S. (Audiokinetic) (40.2k points)
...