ATL Play/Stop Behavior

Overview

Within most places of CRYENGINE's ATL System you have the possibility to define both a PlayTrigger and a StopTrigger.
The following tutorial explains the behavior of the ATL PlayTrigger and StopTrigger implementation.

Main Content

Just the PlayTrigger is Set

On activation this executes the PlayTrigger and on deactivation stops the instance of the PlayTrigger.

The ATL system automatically stops the PlayTrigger when the corresponding StopTrigger (has no assigned ATLTrigger) and is executed.

This functionality can be very useful as it automatically stops Sounds without the need to create any additional stop functionality inside of your Audio Middleware. This also assures that any looping Sounds will be stopped when the Entity is disabled.


Just the StopTrigger is Set

On deactivation the StopTrigger is executed, on activation nothing happens.

As no ATL-Trigger is defined under the PlayTrigger nothing will happen when the PlayTrigger is executed. However, as an ATLTrigger is set for the StopTrigger it will be played when the StopTrigger is executed.

Triggering Audio on the StopTrigger
Remember that an ATLTrigger can also execute the playback of Audio in your Middleware i.e. when it is placed as a StopTrigger.

The PlayTrigger and StopTrigger are both Set

With this configuration, the start trigger is executed on activation. The StopTrigger is activated upon deactivation and without stopping the start trigger.

This will execute the ATLTrigger once the PlayTrigger it is defined in is executed. However, when the StopTrigger is executed the instance of the PlayTrigger won't be stopped because the ATLTrigger has been defined as a StopTrigger.

If you should need to stop the PlayTrigger with another ATLTrigger that is set as a StopTrigger, then you would have to setup the stop-functionality inside of your Audio Middleware.

Example: For an electric generator you would setup a start-up and loop Sound on the PlayTrigger that is executed when the Entity is activated.
When deactivating the Entity you would play an ATLTrigger set under a StopTrigger that would stop the looping Sound and play a shutdown Sound with the functionality provided by your Audio Middleware.

When to use the StopTrigger functionality of the Audio Middleware
As a general rule it is always useful to use the automatic stop behavior contained in the ATL system when you just want to simply stop a Sound on Entity deactivation or on the ending of an animation.
When creating more complex events such as, fade outs or triggering additional Audio samples while stopping the StartTrigger, then you should create a stop functionality inside your Audio Middleware and set the connected ATLControl as the StopTrigger.

Bypassing the Automatic Stopping of a StartTrigger Instance via the "do_nothing" Default ATLControl

On activation the PlayTrigger is executed and will not be stopped on deactivation.

The do_nothing ATLTrigger is an ATL Default Control that is automatically created by the Audio Controls Editor (ACE).

When it is set on the StopTrigger the ATL system will behave as explained in the section "Play and StopTrigger are both Set" found above. However, as the "do_nothing" ATL trigger is not connected to any functionality within your Middleware it will not affect the Audio, but will still bypass the automatic stop functionality of the ATL System.



Example: When setting an ATL-Trigger on a shooting animation say of a gun, then you would want to hear the tail of the gunfire even after the animation has finished. However, if no ATLTrigger has been set in the StopTrigger field, then the PlayTrigger would be terminated and therefore the Sound of the gunfire tail would be cut off. To prevent this place the do_nothing event in the StopTrigger - this bypasses the automatic stopping functionality and lets the PlayTrigger execute completely.

Remember that with the above setup any looping Sounds that you have set as a PlayTrigger will not be stopped.

Result

You have now learned about the Play and StopTrigger behavior of the ATL system and how to make the best use of it in your own Audio implementation.