2 - SDL Mixer and SpotFX

Overview

This tutorial explains how to setup the SDL Mixer for Sounds that are emitting from or around a given spot in a Level.

Setting up SpotFX in SDL-Mixer

Using the AudioTriggerSpot Entity

CRYENGINE uses the AudioTriggerSpot Entity to execute ATL-Triggers that are emitting Sound from or around a given spot in a Level. These Sounds are called SpotFX.

The SDL-Mixer has a basic set of options that are used to specify how the Sound will be played back in the ENGINE.

The AudioTriggerSpot can be found in the RollupBar under Objects/Audio. After selecting the AudioTriggerSpot Entity you can place it anywhere in a Level.
For a detailed explanation on how to correctly setup the AudioTriggerSpot Entity in your Level follow the Instructions found here.

Working with Attenuation

Through the SDL-Mixer you can enable a simple set of 3D properties for each Sound connected to an ATL-Trigger.
These can be accessed in the Inspector by clicking on the ATL-Trigger and then selecting the connected Audio file.

The Enable Panning option, positions the Sound according to the angle between the listener and the Sound source.

Note: The Enable Panning checkbox should always be enabled when placing a Sound in a Level so that a localization of the Sound source is possible.

The Enable Distance Attenuation option linearly attenuates the volume of the Sound (depending on the distance values used) and will create fitting attenuation values. This option should be enabled when placing a Sound in a Level as a SpotFX.

Use the Min Distance: and Max Distance: to define when a Sound will start to attenuate and when it will be fully attenuated. For example, with a Min Distance of 10 and a Max Distance of 30 the Sound will play on full volume during the first 10 meters of moving away from the Sound source and then start to drop off in volume until it will be fully attenuated (silent) at a distance of 30 meters.

Randomizing Sound on the AudioTriggerSpot with SDL-Mixer

If you want to re-trigger a Sound over a certain time frame then you can make use of the randomization feature of the AudioTriggerSpot.

  1. Select the ATL-Trigger and make sure that the connected audio files are not set to loop infinitely and that both Enable Panning and Enable Distance are enabled.
    1. It is setup this way as we are enabling the randomization on the AudioTriggerSpot which will re-trigger the sound.
  2. Randomized Re-triggering:
    1. In CRYENGINE select the AudioTriggerSpot and enable PlayRandom in the AudioTriggerSpot properties.
    2. Set values for the MinDelay and MaxDelay to define the time range over which the ATL Trigger will be re-triggered.
  3. Randomized Positioning:
    1. In CRYENGINE enable PlayOnX/PlayOnY/PlayOnZ in order to enable on which axis of the AudioTriggerSpot the sound position can be randomized on.
    2. Set a value for RadiusRandom to define the range in which the Sounds can be randomized.

This can be useful for adding more variation and interest to the Sound scape in your Level. For example, this can be used to simulate seagulls which can be heard at different points in time and in different positions in the sky.

Result

You have now learned how to setup the SDL-Mixer for SpotFX Sounds to make them play correctly inside CRYENGINE.
Next, learn how to create a setup for Ambiences and the SDL-Mixer.