Wwise Properties in Unreal Engine 5 - C++ (Events, States, RTPC’s, and more…)

Si prefieres leer una versión en Español, da click en este botón =>

Unreal Engine Version: 5.0.3

Wwise Version: 2021.1.9.7847

This blog post is a simple guide about the essential Wwise Properties we need to create our audio systems in Unreal Engine 5. We will learn what they are, what they do, and how to define/declare them in C++ and then expose them to Blueprints. We will use the Event-Based Packaging workflow, which doesn't require any SoundBank build.

IMPORTANT!

〰️

IMPORTANT! 〰️

Prerequisites:

  1. Create an empty C++ third-person project called “MyUE5Project”.

  2. Download and integrate Wwise plugin into your project through the Wwise Launcher.

  3. Activate Event-Based Packaging

For this tutorial to make sense, you need to know how to integrate the Wwise plugin into Unreal Engine. Additionally, consider reading and referencing my previous post about UPROPERTY & UFUNCTION:

IMPORTANT!

〰️

IMPORTANT! 〰️

 

First Steps:

On the UE5 editor, go to Tools > Open Visual Studio or Tools > Open Xcode. 

Open the Content Drawer and click on Settings, then select Show C++ Classes.

The C++ Classes folder will be exposed.

 
 

In the Content Drawer go to "MyUE5Project” folder. Right-click and select “New C++ Class”.

Create an Actor type class and name it “MyCPPActorClass.”

 
 
 
 

Inside your IDE go to Games/MyUEProject/Source/MyUEProject and open both “MyCPPActorClass.cpp” and "MyCPPActorClass.h”

 
 

About .h and .cpp files: Every time you create a class in Unreal Engine, you end up with two files. The .h file or "header" will hold your "Declarations" (Properties/Variables, Constants, and Functions), and the .cpp file will have the "Implementations" or "Definitions" of these declarations.

 

Wwise Properties:

Our properties will be declared on our "MyCPPActorClass.h". To simplify our testing, we will put all these properties under the public access specifier and write this UFUNCTION macro above all of them (Read the UPROPERTY & UFUNCTION post to learn more):


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")

1. Event (UAkAudioEvent*)

An event is the most essential Wwise asset. An event will hold your sound effects and music cues and can be instantiated in your game.

From Audiokinetic - Wwise:

A method to trigger audio in game using an Action or series of Actions, such as Play, Mute, and Pause, that have been applied to one or more Wwise objects.

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkAudioEvent* myAudioEvent;

Editor and Blueprints:

 
 

2. Switch (UAkSwitchValue*)

A Wwise switch is a tool that allows a set of sounds defined on a switch container to be selected and triggered on a local scope. Switches are handy when playing sounds with various alternatives like footsteps or weapon impacts on different types of surfaces. Additionally, Switches can be mapped to be controlled by RTPCs.

From Audiokinetic - Wwise:

A Switch represents the alternatives that exist for a particular element in game, and is used to help manage the corresponding objects for these alternatives. For example, if a character is running on a concrete surface and then moves onto grass, the sound of the footsteps in a Switch Container should change to match the change of surface.

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkSwitchValue* mySwitchValue;

Editor and Blueprints:

 
 

3. State (UAkStateValue*)

A Wwise state is a tool that allows a set of global changes to be triggered by the game engine. A state can control any parameter from Wwise.

From Audiokinetic - Wwise:

A global offset or adjustment to the game audio properties that relates to changes in the physical and environmental conditions in the game.

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkStateValue* myStateValue;

Editor and Blueprints:

 
 

4. RTPC (UAkRtpc*)

A Wwise RTPC (Real Time Parameter Controls) is a tool that allows dynamic and interactive parameter changes in real-time. RTPCs are one of the most powerful Wwise features to create our audio and music systems.

From Audiokinetic - Wwise:

Real Time Parameter Controls. An interactive method used to drive the audio in game by mapping Game Parameter values to properties in Wwise. RTPCs can also be used to drive Switch changes by mapping Game Parameters to Switch Groups.

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkRtpc* myRtpc;

Editor and Blueprints:

 
 

5. Trigger (UAkTrigger*)

A Wwise Trigger is a tool that receives a call from the game engine and forces a sound effect or a music stinger to play synchronized to a rhythmic musical subdivision or a user-defined music cue. Triggers are very useful and essential in music-based games.

From Audiokinetic - Wwise:

A Game Sync that responds to a spontaneous occurrence in the game and launches a Stinger.

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkTrigger* myTrigger;

Editor and Blueprints:

 
 

6. Aux Bus (UAkAuxBus*)

A Wwise Aux Bus is a component of the audio mixer that holds audio effects and can receive audio from any Wwise Container. Aux busses are useful for dynamically simulating spatialization changes with reverb-type effects.

From Audiokinetic - Wwise:

A special type of Audio Bus that is generally used to apply Effects such as Reverbs and Delays for simulating environmental Effects or to allow dynamic mixing

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkAuxBus* myAuxBus;

Editor and Blueprints:

 
 

7. Audio Bank (UAkAudioBank*)

A Wwise Audio Bank will carry your audio events and load them into memory. You can assign your events to different banks. Additionally, you can load/unload them anytime to achieve the best optimization considering your game's design and architecture.

IMPORTANT: Audio Banks are not required on an Event-Based Packaging workflow.

From Audiokinetic - Wwise:

A group of Event data, Sound, Music, and Motion structure data, and/or media files that will be loaded into the game's platform memory at a particular point in a game

.h file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Audio")
UAkAudioBank* myAudioBank;
 
 

Expose Your Properties To The Editor and Blueprints:

After writing all these Wwise properties in your "MyCPPActorClass.h" file, your code should look similar to this:

 
 

Save your modified code. Go back to your UE project and compile.

 
 

Drag "MyCPPActorClass” inside your map on the outliner.

 
 

Create a Blueprint Class based on “MyCPPActorClass” called “MyBPActorClass.” Drag it inside your map on the outliner too.

 
 
 
 

Open your "MyBPActorClass" blueprint event graph. You should be able to see all your Wwise C++ properties on the bottom-left of your editor under Variables > Audio. If you can't see them, try clicking on the cog-shaped icon on the top-right of My Blueprint tab and then select Show Inherited Variables.

 
 
 

THE END

〰️〰️〰️

THE END 〰️〰️〰️

Previous
Previous

FMOD Events in Unreal Engine 5 (Play Event 2D) - Game Audio Basics

Next
Next

FMOD Properties in Unreal Engine 5 - C++ (Events, Instances, snapshots, and more…)