UE4 + Wwise: Change UPROPERTY to accept Wwise Event calls?


I’m a sound designer and have only recently started to delve into game audio and UE4.

Currently, I’m working with the UE4 ShooterGame example (UE4.12.5) and implementing the sound using the Wwise integration (2015.1.9 build 5624).
So far I’ve been able to implement everything using mostly Blueprints but since the weapon sounds are hard-coded, I’m struggling to make the parameters exposed in the editor accept Wwise Event calls.
For example, in the WeapGun Blueprint Class, I’m only able to replace the sounds with other SoundCues.
I’ve traced this to be declared in the ShooterWeapon header file:

/** single fire sound (bLoopedFireSound not set) */

UPROPERTY(EditDefaultsOnly, Category=Sound)

USoundCue* FireSound;

I’ve tried changing the type of the FireSound pointer to ‘AkAudioEvent’, 'UAkAudioEven’t etc. as well as including the AkAudioEvent header (located in Engine/Plugins…). The compiler can’t find the AkAudioEvent header and also complains about the pointer type being unrecognized (which I assume is because of the missing header).

If I include the full path, it searches for AkAudioEvent.generated.h instead which gives me a bunch of new errors and so on.

I’ve also tried reading up on and trying out some things with UCLASSES as well as adding dependencies in the build.cs file with no success.

Am I going about this all wrong?

I would really appreciate if someone could point me in the right direction.


Hey ejsalling, you might want to tap the AK forums as well, but the function you want to replace is called PlayWeaponSound. So basically, everywhere it calls for PlayWeaponSound, you’ll want to play your replacement event call, passing in whatever relevant GameSync data is appropriate.

I haven’t really looked at this code before, but my cursory guess is that the reason the SoundCue is a pointer is because the ShooterWeapon class is designed as a parent from which the weapons in the Shooter Game will be derived and they will pass in SoundCue references that are specific to their definitions.

Overhauling this for another Audio Engine will mean redefining how this ShooterWeapon parent class works and how each of the child classes will pass in their specific data.

As far as UPROPERTY goes, that’s just a UE4 macro to assist in code-gen during the build process (including property reflection), which is important if you’re creating a new weapon child class in the Editor.

Hi Dan. Thank you very much for your reply.
That helped to make some sense of it all.

I think I’ve figured out how the current implementation works and I’ll try modifying the PlayWeaponSound function to call Wwise Events instead of SpawnSoundAttached. Either ignoring the pointers being passed to the function or changing their type to the Wwise equivalents.

But to do that, I need to include some Wwise header files located under /…Engine/Plugins. These headers include the “…h.generated” equivalents of themselves which can’t be found by the compiler. I’m currently looking into adding dependencies in the ShooterGame.Build.cs file. Do you have any suggestions or comments on this?

Thanks again. It’s very much appreciated.
Best regards

Generated means code gen, I don’t know why AK would require you to include a generated header. I would ask AudioKinetic.

The AK headers are part of the Wwise integration for UE4 and contains UCLASSES so I think that’s why. I just found out that is not working so maybe it has something to do with that? I’m looking into it now.

Haven’t received any answers from AK yet.

Thanks, Dan

Maybe the problem has something to do with UE4 being installed from the Launcher instead of building the engine from source code from gitHub? I noticed a lot of additional files for UnrealHeaderTool etc. on gitHub that I don’t have (/…/Engine/Source/Programs).

I’ll just try to make it work with non-AK events or functions and make them accessible from within Blueprints.