社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

+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 分)
...