abstract class in Clatter.Unity
Inherits from MonoBehaviour
Abstract base class for playing audio generated by collision events and ClatterManager
. See: ImpactSound
and ScrapeSound
.
A Sound converts Clatter.Core.Samples
data into a Unity AudioClip, adds an AudioSource component, and plays the audio.
Name | Type | Description | Default Value |
---|---|---|---|
timeout | double | Timeout and destroy a Sound if it hasn't received new samples data after this many seconds. | 0.1 |
onCreate | Sound |
Invoked when the Sound is created. | |
spatialize | bool | If true, spatialize each AudioSource. | true |
Name | Type | Description | Default Value |
---|---|---|---|
onEnd | Action< int > | Invoked when the audio ends. |
public static T Create< T >(Samples samples, Vector3d position, int id)
Create a new sound.
Name | Type | Description |
---|---|---|
samples | Samples |
The audio samples. |
position | Vector3d |
The position of the audio source. |
id | int | The audio source ID. |
public void End()
Gracefully end the audio and prepare to self-destruct.