Unreal Engine 4 Microsoft Spatial Sound Implementation

The implementation of the Spatial Sink plugin requires a couple of small code-side changes in the UE4 solution, and one addition to the Wwise content. 

The first step is to make sure that the Plugin is installed to the Wwise tool and SDK.  The plugin is available via the Wwise Launcher plugins install:

Once the plugin is installed to your Wwise SDK, you should be able to follow the below steps to get Spatial Sink plugin up and running in the title in the UE4 environment:

Unreal Engine 4 Code Integration

Note: the following instructions assume you are adding this plugin into an existing wwise install that had not yet had the MSSpatialSound plugin installed. You will not need to do this if the MSSpatialSink was already in your Wwise SDK when you installed it to UE4.

1. Copy the plugin runtime libraries from the Wwise SDK folders to the UE4 Wwise Plugin “Third Party” folders:

a. The plugin package will install the MSSpatialSink plugin libraries to your Wwise SDK install.  You will then need to make sure these are added to the UE4 Wwise plugin third party folders.

b. Once the MSSpatialSink.lib libs are properly located within the above folders, they will be able to be linked into the title.
c. Remember to copy into ALL configurations – Debug, Profile, Release subfolders.

2. Copy the plugin header file from the Wwise SDK into the UE4 Wwise plugin:

a. Find the plugin header file MSSpatialSinkFactory.h in the Wwise\SDK\include\AK\Plugin folder.
b. Copy that header into the UE4 Wwise plugin third party include\AK\Plugin folder:

3. Update the AkAudio.Build.cs file to include the MSSpatialSink library:

a. In the AkAudio.Build.cs file, you will need to add reference to the MSSpatialSink so the title will link the library into the project.
b. That will look something like the following:

c. Note that the MSSpatialSink is supported ONLY on Xbox One platform and Microsoft Windows platforms.

4. In AkAudioDevice.cpp you will just need to register the plugin which is done simply by adding the factory header of the plugin:

a. To do this you simply need to include the MSSpatialSinkFactory.h along the lines of the following (again this is only on Microsoft Windows and Xbox One platforms):

5. Finally, you’ll need to make the call to EnableSpatialAudio(). NOTE: this is ONLY for the Xbox One. You do NOT need this for Windows 10.

a. The EnableSpatialAudio() API, MUST be called before any other audio device activation or enumeration, including Bink, Chat, etc. In UE4, the best place to make this call is in LaunchEngineLoop.cpp in the AppInit API. It looks like the following:

b. Again, note that this is Xbox One ONLY EnableSpatialAudio() is defined in mmdeviceapi.h.

The above is all that is needed from the code solution side.  There is now one addition needed to the Wwise content and then everything should be in place to be run the title using full Spatial audio.

Wwise Content Addition

For the content side of things, you simply need to add a new Audio Device shareset for the Spatial Sink plugin to the Master bus. Assuming that the spatial plugin been installed into the local Wwise install, adding the device share set looks like the following:

1. In the Wwise tool on the Master Audio Bus property editor under General Settings you can set the Audio Device for the bus. It will default to “System”, but you can use the GUI to create a new Microsoft Spatial Sound Platform Output device and set that for use on the Master bus
2. It looks something like this:

3. The device you create will show up under the Audio Devices in the Sharesets Tab of the Project Explorer (you can also create the device in the sharesets and then select it as the device on the bus):

4. Make sure to rebuild the content.  The device shareset addition should modify ONLY the Wwise Init.bnk so this is a very small change to the content side of things.
5. NOTE: make sure to disable any other spatial DSP (such as the Occulus plugin) or else the content will get doubly processed.

Once all the above steps are done, when you run the game, the title should be running in a 12 channel 7.1.4 configuration automatically.  You’ll be able to tell this by observing the channel configuration of the Master Bus when profiling the game with the Wwise tool.  With this in place sounds will not only sound like they are coming from around you, but if the sound emitter is above you it should also sound like it is above you.