Skip to main content

AudioControl

A class in Root.Township, the global namespace.

Plays one Wwise event on a game object and lets you stop, seek or reapply sound properties while it plays. Builds on SimpleAudioControl.

Constructors​

MemberWhat it is
AudioControl()Creates an AudioControl with default values.

Fields​

1 private and internal field
MemberWhat it is
private bool isPlayingTrue between Play and the sound's end callback.

Properties​

MemberWhat it is
AkGameObj AkGameObj { get; private set; }The Wwise game object the sound plays on. Null once it has finished.
bool IsExhausted { get; }True when nothing is playing, so Stop and Seek do nothing.
Event SoundEvent { get; private set; }The Wwise event being played. Null once it has finished.
HashSet<ISoundProperty> soundProperties { get; private set; }Sound properties added by Play. They aren't cleared between plays.

Methods​

MemberWhat it is
override void Play(Event soundEvent, AkGameObj akGameObj, Action endAction = null, params ISoundProperty[] soundProperties)Stops any sound already playing, then plays the event with the given sound properties and an optional end callback.
void ReapplySoundProperties()Applies all stored sound properties to the game object again.
bool Seek(float timePercentage)Jumps the playing sound to a point given as a fraction of its length. False if nothing is playing.
bool Stop()Stops the playing sound. False if nothing was playing.
1 private and internal method
MemberWhat it is
private void ExhaustSound()Called when the sound ends: clears isPlaying, AkGameObj and SoundEvent so IsExhausted turns true.

Used in​

Members of other types that take, return or hold a AudioControl: