What is Event-Based Packaging?
Not long ago, the UE4 Integration of Wwise 2019.2 launched a new asset management workflow called Event-Based Packaging, or EBP for short. Compared with the traditional SoundBanks workflow, this new pipeline is characterized by event packaging, that is, the resources of each event are packaged into an individual SoundBank.
Why would you want to do this? The reason is that in Wwise's traditional pipeline, the user is left to decide how to organize SoundBanks. In larger projects, this organization often takes a lot of time. And because it is manually organized and managed, redundancy is almost inevitable when loading resources. In the new EBP workflow, the resources corresponding to each event are automatically packaged into a SoundBank and stored in the
.uasset of the event. When the event is called, only the corresponding media resources are loaded, effectively only loading as many resources as needed. This also means that the occurrence of resource redundancy is fundamentally eliminated. And since each
SoundBank only contains the resources of one event, they can be flexibly unloaded without worrying about other events losing access to a resource.
This article will introduce some key resources used in the EBP workflow and their loading process, helping everyone better understand the new pipeline.
Note: If you'd like to read the most recent article about the Wwise Unreal Integration, please check out the blog "Improving the Wwise Unreal Integration".
EBP and WAAPI
To make automatic packaging based on events in UE4 work, it is necessary to obtain the Event and the corresponding relationship between the Event and the sound media. In this process, the EBP pipeline is dependent on WAAPI. WAAPI means Wwise Authoring API, which is an API that allows external applications to communicate with the Wwise Authoring tool. Users can control the Wwise Authoring tool by calling these APIs, so WAAPI can also be understood as a bridge between the UE4 project and the Wwise project.
When you create an Event in the Wwise authoring tool, the UE4 integration will automatically create the corresponding
event.uasset after receiving the operation instruction through the registered callback function. Similarly, when the user clicks the Generate Sound Data button in the WAAPI Picker panel in UE4, the Generate SoundBanks operation will be executed in the Wwise Authoring tool. In the EPB workflow, WAAPI is used to ensure that UE4 and the Wwise project are always synchronized.
Connecting Wwise through WAAPI to generate SoundBanks is the preferred but not the only way to generate Sound Data. If you cannot use WAAPI to connect to the Wwise Authoring tool, you can click the Generate Sound Data button in the Wwise Picker window to start the generation process using Wwise Console. The generation speed is slower compared to WAAPI because it uses more system I/O calls, but the resulting assets are the same. You can also reach the Generate Sound Data dialog in Unreal's Build menu in the Audiokinetic section.
Wwise resources in UE4
In the sound development process, users can use the Event, State, Switch, RTPC, Bank, Auxiliary Bus, and Media resources in Wwise to construct and weave the sound world in the project. In UE4, these resources all exist in the form of .uasset and are stored in the
Content/WwiseAudio/ folder by default. The location of the project’s Wwise resources can be configured in the Wwise Integration Settings section of the UE4 Project Settings, by modifying the “Wwise Sound Data Folder” setting.
The following table lists the corresponding classes of Wwise resources and where they are stored in the UE4:
Derived from the above resources, these derived classes need to be reserialized to turn themselves into objects. Deserialization refers to the process of converting a byte stream into an object in memory. The following figure is a class diagram of all Wwise resources. You can see the derivation of all resources:
In the game, developers can load these through resource references and C++ code. For objects dragged and dropped in the scene or resources referenced through the Component property, when the Component object is instantiated, the Wwise resources in it will also be loaded. In addition, these resources can also be loaded by calling the
LoadObject() function in the UE4.
In the editor, the task of loading resources derived from the
UAKAudioType class is completed by the
AkAssetDatabase class, and its constructor will register the three events
onAssetRenamed. Among them,
onAssetAdded is responsible for handling the loading of all resources. In fact, when you open the UE4 engine editor, all Wwise resources for the current map are loaded.
The loading of a
media.uasset is carried out with the instantiation of an
event.uasset. We will discuss in detail the loading process in a later section. Next, let’s take a look at the two most important resources, which are
Event-Based Packaging Process Overview
The resources that users interact with the most are the various events in the game. There is a one-to-one relationship between events in the Wwise Authoring tool and
event.uasset resources in the UE4 project. Events are used to perform actions such as playing, pausing, setting a Switch or a State. In EBP, each
event.uasset contains an Event’s content for all platforms defined in the Wwise project. The key information is the SoundBank and media resource paths that the Event depends on. There is only Event and Structure data in the SoundBanks, not the media resource itself, so the
event.uasset file size is only a few KB. The media resource path is the basis for finding and loading media resources.
The content of media.uasset
Different Events sometimes refer to the same audio file. This is very common, but it can lead to resource redundancy. In order to implement the sharing of sound files between
event.uasset, all the media are stripped from SoundBanks and are stored separately in the
Content\WwiseAudio\Media\ folder by default. According to the organization method used in the Wwise Authoring tool, each Audio Source that the Event depends on corresponds to a
media.uasset file. As described for
event.uasset, media.uasset files include the contents for all platforms in one file. When the user adds a new platform, the file size of
media.uasset will increase as that platform’s media is added to the file.
Media resources are named by ID. If you want to find the corresponding
MediaName, you can browse
Content\WwiseAudio\Media in UE4's Content Browser and display it in Columns.
The loading process of Wwise resources
Now that we understand the contents of the two most important resources, event.uasset and media.uasset, let’s take a look at the steps taken to load them. Since
SoundBanks and media have been stored separately, when loading resources, you need to load the SoundBank first, and then load the media it references.
Loading the Soundbank
When using Wwise, the SoundBank that the event depends on must be loaded before
PostEvent is called, and the same is true in EBP. During the loading process of
SoundBank will be automatically loaded, that is, all Event and Structure will be loaded. One thing to note is that in EBP, when the
event.uasset is instantiated, the
SoundBank has already been loaded into the memory, which means that the loaded SoundBank is in UE4’s reserved memory, not the memory reserved by Wwise. The Sound Engine will receive the memory address as an argument to the
AK::SoundEngine::LoadBankMemoryView() function that loads the SoundBank.
Loading the required Media
Once SoundBank loading is complete, the
media.uasset will also be loaded. This step consists of loading the media through the media resource path saved in the
event.uasset. Therefore, it is located in UE4’s reserved memory like the SoundBank.
The EBP pipeline does not use
PrepareEvent to load media. Instead, it provides the memory location of the media resource to the SoundEngine through the
SetMedia() function. Each
media.uasset will only be instantiated once, so there is no need to worry about data being loaded redundantly.
This article briefly introduced the main resources used in the EBP asset management workflow and their loading process, hoping to help readers understand the organization of this pipeline. Being relatively new, the EBP pipeline will be updated and improved upon in subsequent releases, and hence, the contents of this article may be subject to change. Nevertheless, I believe that the automated management of SoundBanks can save considerable time and cost for the game audio development process. It is expected to become more mature and stable in the near future, bringing benefits to more game development teams.
February 08, 2023 at 02:52 pm
Is this going to be integrated into Unity as well? Would be awesome not to have to worry about Soundbanks. Best, Rafael