Previous: , Up: Audio   [Contents][Index]


3.2 Sounder

Component: Sounder

The ultimate audio component! This component allows you to play arbitrary sounds based on messages sent from other components. To use, add it to the source object where you want sound to originate. For a single sound, just add the sound to the ’Audio Clip’ attribute in the ’Audio Source’ comonent attached to this object. If you want to play one of a set of sounds, add them all to the ’Clips’ attribute above. Then, send the message ’PlaySelectedSound’ with an integer (starting at 0) indicating which you wish to play. For example, to play the second sound send ’PlaySelectedSound’ with parameter ’1’ and ’Integer’ parameter mode. Any message sender can be used, for example the ’Key Message’ component can trigger this Sounder with the press of a key.

See https://www.youtube.com/watch?v=OsV4l0QzMA0.

Field of Sounder: AudioClip[] clips

A list of clips we can play by using ’PlaySelectedSound’ and sending an integer representing which clip we want. 0 for first, 1 for second and son forth

Playback Settings

Field of Sounder: float cooldown

How long do we need to wait between sounds?

Default value: 0.3f

Field of Sounder: float pitchVariance

How much should we vary the pitch each time?

Default value: 0f

Optional Field of Sounder: float pitchOffset

How much lower or higher do we want the default to be?

Default value: 0f

Available Messages

Message on Sounder: PlaySound ()

Plays the sound currently assigned to the Audio Source attached to this object

Message on Sounder: PlayRandomSound ()

Plays one from a random selection of sounds in the list of ’Clips’

Message on Sounder: PlaySelectedSound (int)

Plays a specific sound from the list of ’Clips’

Argument: What is the index of the sound we want to play? Remember, the first element starts at 0

Message on Sounder: StopSound ()

Stops the Audio Source from continuing to play the sound.

Message on Sounder: SetVolume (float)

Changes the volume for this Audio Source only

Argument: A floating point number between 0 and 1 indicating the new volume level.

Field of Sounder: AudioClip[] clips

A list of clips we can play by using ’PlaySelectedSound’ and sending an integer representing which clip we want. 0 for first, 1 for second and son forth

Playback Settings

Field of Sounder: float cooldown

How long do we need to wait between sounds?

Default value: 0.3f

Field of Sounder: float pitchVariance

How much should we vary the pitch each time?

Default value: 0f

Optional Field of Sounder: float pitchOffset

How much lower or higher do we want the default to be?

Default value: 0f

Available Messages

Message on Sounder: PlaySound ()

Plays the sound currently assigned to the Audio Source attached to this object

Message on Sounder: PlayRandomSound ()

Plays one from a random selection of sounds in the list of ’Clips’

Message on Sounder: PlaySelectedSound (int)

Plays a specific sound from the list of ’Clips’

Argument: What is the index of the sound we want to play? Remember, the first element starts at 0

Message on Sounder: StopSound ()

Stops the Audio Source from continuing to play the sound.

Message on Sounder: SetVolume (float)

Changes the volume for this Audio Source only

Argument: A floating point number between 0 and 1 indicating the new volume level.


Previous: , Up: Audio   [Contents][Index]