Version
menu_open
Wwise Unreal Integration Documentation
WwiseProjectDatabase Module

The WwiseProjectDatabase module is available to uncooked projects, including in the Editor. This module provides a memory-based database view of the current state of the Wwise project’s generated SoundBanks. Every value and piece of information available in the JSON metadata files produced when generating SoundBanks is accessible in the Project Database. This view is purely informative and only changes when the generated files are updated. References to structures in the database are thread-safe, even when a new database version is loaded asynchronously.

There are two representations of information in the database:

  • The Metadata structures provide the raw information from the JSON files.
  • The Ref classes allow access to the neighboring information related to the metadata.

Metadata Structures

The Metadata structures are defined exactly like the JSON files that describe the generated SoundBanks metadata. No context is provided and there are few convenience tools. With very few exceptions, the member names in these structures are identical to those in the JSON files.

For the file definition itself, you start from a WwiseMetadataRootFile object that defines the kind of optional root objects the file can declare. Then, the structures expose the different inner objects and values that can occur.

After they are loaded in memory, these structures present a clear image of the generated SoundBanks in a compact and efficient form.

Only one copy of this information is kept in memory in FWwiseRootDataStructure and FWwisePlatformDataStructure JSON files.

Ref Classes

The Ref classes define each metadata object again but through a description of how to locate the necessary metadata. This class is helpful because the metadata in the generated SoundBanks is written with very little information duplication and instead uses references to various data structures. Therefore, Events have a media list referencing them by ID, but the metadata for that media, such as the file location, is defined in the higher-level SoundBank metadata.

For example, to point towards an Event’s Switch Container value, a Ref class keeps a shared pointer copy to the file’s root and contains directions to locate the Switch Container. The directions would be something like: this file, in the SoundBanks structure, the 1st SoundBank, the 4th declared Event, the 3rd declared Switch Container.

This is illustrated by the following code samples:

struct WWISEPROJECTDATABASE_API FWwiseMetadataMediaAttributes : public FWwiseMetadataMediaReference
{
FName Language;
bool bStreaming;
EWwiseMetadataMediaLocation Location;
bool bUsingReferenceLanguage;
uint32 Align;
bool bDeviceMemory;
FWwiseMetadataMediaAttributes(FWwiseMetadataLoader& Loader);
private:
static EWwiseMetadataMediaLocation LocationFromString(const FName& LocationString);
};
struct WWISEPROJECTDATABASE_API FWwiseMetadataMedia : public FWwiseMetadataMediaAttributes
{
FName ShortName;
FName Path;
FName CachePath;
uint32 PrefetchSize;
FWwiseMetadataMedia(FWwiseMetadataLoader& Loader);
};

and this example media:

"Media": [
{
"Id": "274591330",
"Language": "English(US)",
"Streaming": "false",
"Location": "Loose",
"ShortName": "Hello.wav",
"Path": "Media/English(US)/27/274591330.wem",
"CachePath": "Voices/English(US)/Hello_10C4C929.wem"
}

In essence, the Ref classes provide context. Hence, you can get the Switch Container information, and you can also get information about the class parents: the Event, the SoundBank, and the file.

Some referred types mandate supplemental information. For example, the Platform Information has its information split into two complementary files: the ProjectInfo.json and the PlatformInfo.json, so the platform Ref naturally contains two different structures. Similarly, some other referred types might reside in multiple locations, and the Ref class attempts to accommodate these particularities.

Finally, the Ref classes provide additional utilities. If you pass the necessary global maps, you can get supplemental information alongside the Ref classes that are included inside that particular Wwise object. For example, you can ask for the media requested in a particular Event’s definition, and it will return the media as Refs.

Because the Ref information is declared as the base and derived structs, in a Switch Container, you can request all of the Event’s Switch Container values and get the siblings simultaneously. The same is true for other types of information contained in Events.

AnyRef Class

At a higher level, the AnyRef class holds a pointer towards any kind of Ref structure. It contains the type and a shared pointer. There are limited operations available at the AnyRef level, such as retrieving the object’s Short ID, its GUID, and its name. For everything else, you can ask to cast the boxed Ref object to its type. It can point toward a Null object, so the AnyRef type is not a reference but a pointer to a Ref object.

Accessing Information: WwiseProjectDatabase and WwiseDataStructure

The WwiseProjectDatabase module handles queries through its accessing methods. You can, for example, ask for all known SoundBanks or one particular SoundBank. The data itself is kept in its DataStructure member.

Inside the Data structure, there are two structures:

  • The Root structure contains basic information for each platform for a particular project’s structure:
    • The Platform list, which includes all available platforms for a project, even if they aren’t loaded.
    • The Language list
  • The Platforms structure map contains all of the project’s information per platform.

Typically, only one platform is loaded in the WwiseProjectDatabase at one time for cooking and packaging purposes; however, it is possible to load more than one platform.

Note:
While working with your project’s Unreal Editor on a Mac, only the Mac platform must be loaded.

The Data structure’s structs contain:

  • A list of all loaded file names in the GeneratedPlatformFiles property.
  • One unique copy of each parsed JSON file in the JsonFiles property.
  • Refs for each accessible piece of data.

In addition, the Data structure allows templated accesses through functions such as GetRef.


Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise