menu
 

在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

+1 投票
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
分类:General Discussion | 用户: Pandemius (120 分)

1个回答

0 投票

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.

用户: Mads Maretty S. (Audiokinetic) (40.2k 分)
...