The AudioComponent handles interactions with audio components.
public class AudioComponent : Sansar.Script.InstanceInterfaceMembers at a glance
| Kind | Members |
|---|---|
| Fields | ComponentType |
| Properties | ComponentId · Name |
| Methods | PlaySoundOnComponent · PlayStreamOnComponent · ToString |
Fields
ComponentType
public static readonly ComponentType ComponentTypeThe AudioComponent.ComponentType of this component
Properties
ComponentId
public Sansar.Script.ComponentId ComponentId { get; }Retrieves the component id for this AudioComponent.
Value: Sansar.Script.ComponentId — The id.
Name
public string Name { get; }This AudioComponent name, as specified in the editor.
Methods
PlaySoundOnComponent
public PlayHandle PlaySoundOnComponent(
SoundResource soundResource,
PlaySettings playSettings
)Play sound on this component (and follow its position).
| Parameter | Type | Description |
|---|---|---|
soundResource | SoundResource | The sound resource to play. |
playSettings | PlaySettings | The play parameters. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for all agents in this scene. As the component moves, this sound will follow the component’s location.
PlayStreamOnComponent
public PlayHandle PlayStreamOnComponent(
StreamChannel streamChannel,
float loudness
)Play web audio stream on this component (and follow its position).
| Parameter | Type | Description |
|---|---|---|
streamChannel | StreamChannel | Channel of the audio stream to play. |
loudness | float | Relative loudness in dB. |
Returns: PlayHandle — The play handle for controlling playback.
Remarks
Plays for all agents in this scene. As the component moves, this stream will follow the component’s location.
ToString
public override string ToString()A string representation of this object.
Returns: string — A string representation of this object.
Remarks
The format of this string may change between releases.
Used in examples
Generated from the Sansar 47.10.0 client ScriptApi snapshot.