ADX2 Beginner’s Guide #3 – Selectors and Game Variables

Armed with the knowledge of the different types of Cues in ADX2, we can now implement more complex behaviours by using Selectors and Game Variables.

Selectors

Selectors are objects that can take several predefined values called Selector Labels. As their name implies, the Selector Labels are defined as strings. At runtime, Cues will check the value of a Selector and only play the Tracks associated with the corresponding Selector Label. Selectors are managed in the Project Tree’s Selector Folder. To set one up:

  • Right-click on the Selector Folder and Create a Selector.
  • Under the new Selector, Create Selector Labels.

01 Selector Folder

 

Cues of the Switch, Polyphonic, or Track Transition by Selector types can use Selectors. This allows for a variety of use cases:

  • Switch Cue: Every track must be assigned to a Selector Label. Only the Tracks linked to the selected Label will be played. This type of cue is particularly useful for all the sounds that are bound to a specific type of material in the game, e.g., footsteps, impacts, foley… In these cases, when the material changes in the game, set the correct label on the code side, and the correct Track will be played.
  • Polyphonic Cue: Tracks can be freely assigned to a Selector Label. A Track without a Label will always be played, while a Track with a Label will only be played when the corresponding Label is selected. This is useful if you want to add a specific layer to a sound depending on the game situation. For example, for an ambience, you could have a daytime label and a nighttime label that play extra layers based on the time of the day.
  • Track Transition by Selector Cue: Tracks must be assigned to a Selector Label. When switching Labels during playback, the sound will cross-fade to the Track corresponding to the selected Label, creating a smooth transition. Because transitions can be synchronized to the beat, it is especially useful when implementing interactive music.

Here is how to assign a Selector Label to a Track:

  • Select a Cue of type Switch, Polyphonic, or Track Transition by Selector.
  • In the timeline view, click on the Combo box with the Selector Label icon at the bottom track’s header.
  • The Default Selector Label property can also be changed if you need to have a default Selector configuration.
  • In the case of a Switch Cue, the Switch Variable property must first be set to a specific Selector in order to assign Labels to the tracks.

02 Selector Track

At runtime, Selector Labels can be changed at the Cue and Player level – allowing for great granularity – or globally to affect all cues associated with the targeted selector. To set a Selector globally, the Global Label property must be changed programmatically.

Game Variables

Game Variables work similarly to the Selectors but use float values between 0 and 1 instead of string Labels to switch the Track being playback. Game Variables can be created in the Game Variables folder of the project tree. An Initial Value can be set for each variable.

03 GameVariable Folder

Game variables are handled globally by the runtime library, so they affect all Cues that reference them. In addition, it is only possible to use Game Variables with a Cue of type Switch. The Switch Variable property must be set first, and instead of specifying a Label, a range between 0 and 1 must be set for each Track.

04 GameVariable Settings

Game Variables are really useful for changing the sound based on physics parameters like force, velocity, acceleration, etc. For instance, you could design variations of impact sounds at different intensities, and then adjust the Game Variable of the Cue to switch to the correct sound variation based on values received from the game’s physics engine.

Of course, Selectors and Game Variables can be mixed (using Sub Sequences for instance) to create even more complex interactions. In the next post, we will see even more ways to create advanced audio behaviors with Cue’s Markers and Actions!

Leave a Reply

Your email address will not be published. Required fields are marked *