AudioMixer Manager

Overview

The AudioMixer manager is responsible for managing the communication between Fabric's event system and Unity's Audio Mixer allowing to transition to different snapshots at runtime.

Overview

Inspector Elements

AudioMixers: The audio mixers list allows to register multiple mixers with Fabric.

  • Size: Sets the list size
  • Element 0...N: Stores the audio mixer asset, simply drag and drop the mixer resource file from the Project view to the element property.

Actions

The audio mixer provides the following event actions,

  • Fabric.EventActions.LoadAudioMixer: Loads a mixer resource at runtime, passing the name of the mixer in the parameter name.
  • Fabric.EventActions.UnoadAudioMixer: Unloads a mixer resource at runtime, passing the name of the mixer in the parameter name.
  • Fabric.EventActions.TransitionToSnapshot: Activates a mixer snapshots.

NOTE: These event actions are supported in the EventTrigger component.

 

Example on how to post a TransitionToSnapshot event action in code,

 

// Allocate this once during initialisation

Fabric.TransitionToSnapshotData transitionToSnapshotData = new Fabric.TransitionToSnapshotData();

// In game you do this

transitionToSnapshotData._snapshot = "Snapshot"; // Name of snapshot

transitionToSnapshotData._timeToReach = 0.0f; // time to reach, in seconds

Fabric.EventManager.Instance.PostEvent ( "AudioMixer", Fabric.EventAction.TransitionToSnapshot, transitionToSnapshotData);