Api Sandbox SoundHandle
class

SoundHandle

public class SoundHandle

A handle to a sound that is currently playing. You can use this to control the sound's position, volume, pitch etc.

Properties

Name Type Description
Position Vector3 Position of the sound.
Rotation Rotation The direction the sound is facing
Transform Transform This sound's transform
Volume Single Volume of the sound.
Name String A debug name to help identify the sound
SpacialBlend Single How 3d the sound should be. 0 means no 3d, 1 means fully
Distance Single How many units the sound can be heard from.
Falloff Curve The falloff curve for the sound.
Fadeout Curve The fadeout curve for when the sound stops.
Fadein Curve The fadein curve for when the sound starts.
Decibels Single
Pitch Single Pitch of the sound.
IsPlaying Boolean Whether the sound is currently playing or not.
Paused Boolean Whether the sound is currently paused or not.
Finished Boolean Sound is done
Reflections Boolean Enable the sound reflecting off surfaces
Occlusion Boolean Allow this sound to be occluded by geometry etc
OcclusionRadius Single The radius of this sound's occlusion, allow for partial occlusion
DistanceAttenuation Boolean Should the sound fade out over distance
AirAbsorption Boolean Should the sound get absorbed by air, so it sounds different at distance
Transmission Boolean Should the sound transmit through walls, doors etc
TargetMixer Mixer Which mixer do we want to write to
SampleRate Int32 How many samples per second?
IsStopped Boolean True if the sound has been stopped
ElapsedTime Single
Time Single The current time of the playing sound in seconds. Note: for some formats seeking may be expensive, and some may not support it at all.
ListenLocal Boolean Place the listener at 0,0,0 facing 1,0,0.
Loopback Boolean If true, then this sound won't be played unless voice_loopback is 1. The assumption is that it's the local user's voice. Amplitude and visme data will still be available!
Amplitude Single Measure of audio loudness.
IsValid virtual Boolean
FollowParent Boolean Update our position every frame relative to our parent
LocalTransform Transform If we're following a parent, our position will be this relative to them.
Parent GameObject If set with a parent and is true, we will update our position to match the parent's world position. You can use to set an offset from the parent's position. Setting a parent also allows you to use GameObject.StopAllSounds on the parent to stop all sounds that are following it. This is set automatically when calling on a GameObject, but you can set it manually if you want to change the parent of an existing sound handle.
LipSync LipSyncAccessor Access lipsync processing.

Methods

Void Stop(Single fadeTime = 0)
virtual Void Dispose()
Void Update()

Called to push changes to a sound immediately, rather than waiting for the next tick. You should call this if you make changes to a sound.

static Void GetActive(List<SoundHandle> handles)
Void ClearParent()

Clear our parent - stop following

Void SetParent(GameObject obj)

Tell the SoundHandle to follow this GameObject's position

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SoundHandle