Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

0 votes
Because of the very large amount of objects and events to be created in our Wwise project, we would like to generate work units using our own tools. Is this possible? Where can I find the XML schemas?
in General Discussion by Moderator (Audiokinetic) (490 points)

2 Answers

+2 votes
 
Best answer
Yes, it is possible to generate work units using your own tools.

You can find the XML schema under:
\Authoring\Data\Schemas\
You should always use the highest schema version available

The unique ShortIDs found in the wwu for each audio objects are a FNV hash where:
 
 - For Events, Game Syncs and Soundbanks, the hash is implicit, and should not be
   declared in the XML. (It is a 32 bit FNV hash of the name of the object)
 
 - For all other objects (WorkUnit, Sound, Container, Bus, etc), it is a 30 bit FNV 
   hash of the GUID bytes.  If you omit it, Wwise will automatically generate it 
   the next time the project is saved.

GUIDs are created as usual using:
C#: Guid id = Guid.NewGuid();
C++: GUID id; CoCreateGuid( &id );

you can find our C++ implementation of the FNV hash algorithm in the SDK:
\SDK\include\AK\Tools\Common\AkFNVHash.h
by Moderator (Audiokinetic) (490 points)
selected by Claude B. (Audiokinetic)
I tried using your C# ShortIDGenerator to generate the ShortID and could not get a result that matched the value Wwise generates when they're missing. I set HashSize to 30, and passed the GUID as a string in various formats. I've tried to generate ShortIDs for an AudioFileSource, Attenuation, and a Sound and none matched what Wwise generated.

I just tried it based on an example from the related post:
<Action Name="Play" ID="{E1C49A0B-74B2-4346-8251-5B65D5BC44AA}" ShortID="723191257" Type="Play" Scope="One" Global="false">
Using that GUID, I couldn't generate a ShortID that matched.

I generated it like this:
            AkUtilities.ShortIDGenerator.HashSize = 30;
            uint shortID = AkUtilities.ShortIDGenerator.Compute("E1C49A0B-74B2-4346-8251-5B65D5BC44AA");
The result was 754384377, when I would expect 723191257.

Has the method changed since this post was written? Am I missing something?

It's notable that it does work for generating the implicit 32bit ShortID based on the names of Events and Game Syncs.

Thanks
+1 vote

Since this is the first hit on Google for "Wwise ShortID", I'll use this to share some important details that aren't mentioned in the SDK.

The input for the FNV function should be the GUID bytes in mixed-endian order. The first three components are little-endian, and the last two are big-endian. In other words, convert the hex pairs in the GUID to an unsigned byte array and sort them this order: 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15.

Here's a C# implementation that returns the correct ID for both GUIDs and strings. If anyone else is stuck on this, feel free to use it as-is, or as a reference if you need it in another language.

https://github.com/Lolginer/misc/blob/master/WwiseHash.cs

by Adam N. (160 points)
Thank you!  The reasoning for the mixed-endian eludes me, but I appear to be getting valid ShortIDs now.
What I'm wondering about is: MediaID's. How can we generate those without opening Wwise authoring tool? The only way I know of is to use WwiseConsole commands:

move-media-ids-to-single-file
update-media-ids-in-single-file
move-media-ids-to-work-units

This works, but it's incredibly inefficient, especially when you just just want to generate a single mediaID. Is there a formula/hash for how mediaID's are generated?
...