SoundHandleclass

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

objectSoundHandle
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public class Sandbox.SoundHandle

Methods7

Showing 7 methods

public void ClearParent()PUBLICOBSOLETE

Clear our parent - stop following

Obsolete: Just use Parent property directly

Returns:void

public virtual sealed void Dispose()PUBLICVIRTUAL

Returns:void

protected virtual override void Finalize()PROTECTEDVIRTUALOVERRIDE

Returns:void

public static void GetActive(System.Collections.Generic.List`1<Sandbox.SoundHandle> handles)PUBLICSTATIC

ParameterTypeDescription
handlesList<SoundHandle>
Returns:void

public void SetParent(Sandbox.GameObject obj)PUBLICOBSOLETE

Tell the SoundHandle to follow this GameObject's position

Obsolete: Just use Parent property directly

ParameterTypeDescription
objGameObject
Returns:void

public void Stop(float fadeTime = 0)PUBLIC

ParameterTypeDescription
fadeTime = 0float
Returns:void

public void Update()PUBLICPER-FRAMEOBSOLETE

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.

Obsolete: This no longer needs to exist

Returns:void

Properties37

Showing 37 properties

public bool Sandbox.SoundHandle.AirAbsorption { get; set; }PUBLICGETSET

Should the sound get absorbed by air, so it sounds different at distance

Returns:bool

public float Sandbox.SoundHandle.Amplitude { get; set; }PUBLICGETSET

Measure of audio loudness.

Returns:float

public float Sandbox.SoundHandle.Decibels { get; set; }PUBLICGETSETOBSOLETE

Obsolete: This is not used anymore

Returns:float

public float Sandbox.SoundHandle.Distance { get; set; }PUBLICGETSET

How many units the sound can be heard from.

Returns:float

public bool Sandbox.SoundHandle.DistanceAttenuation { get; set; }PUBLICGETSET

Should the sound fade out over distance

Returns:bool

public float Sandbox.SoundHandle.ElapsedTime { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Use Time instead

Returns:float

public Sandbox.Curve Sandbox.SoundHandle.Fadein { get; set; }PUBLICGETSET

The fadein curve for when the sound starts.

Returns:Curve

public Sandbox.Curve Sandbox.SoundHandle.Fadeout { get; set; }PUBLICGETSET

The fadeout curve for when the sound stops.

Returns:Curve

public Sandbox.Curve Sandbox.SoundHandle.Falloff { get; set; }PUBLICGETSET

The falloff curve for the sound.

Returns:Curve

public bool Sandbox.SoundHandle.Finished { get; set; }PUBLICGETSET

Sound is done

Returns:bool

public bool Sandbox.SoundHandle.FollowParent { get; set; }PUBLICGETSET

Update our position every frame relative to our parent

Returns:bool

public bool Sandbox.SoundHandle.IsPlaying { get; set; }PUBLICGETSET

Whether the sound is currently playing or not.

Returns:bool

public bool Sandbox.SoundHandle.IsStopped { get; set; }PUBLICGETSET

True if the sound has been stopped

Returns:bool

public virtual sealed bool Sandbox.SoundHandle.IsValid { get; set; }PUBLICVIRTUALGETSET

Returns:bool

public bool Sandbox.SoundHandle.ListenLocal { get; set; }PUBLICGETSET

Place the listener at 0,0,0 facing 1,0,0.

Returns:bool

public Transform Sandbox.SoundHandle.LocalTransform { get; set; }PUBLICGETSET

If we're following a parent, our position will be this relative to them.

Returns:Transform

public bool Sandbox.SoundHandle.Loopback { get; set; }PUBLICGETSET

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!

Returns:bool

public string Sandbox.SoundHandle.Name { get; set; }PUBLICGETSET

A debug name to help identify the sound

Returns:string

public bool Sandbox.SoundHandle.Occlusion { get; set; }PUBLICGETSETOBSOLETE

Legacy alias for `Sandbox.SoundHandle.OcclusionEnabled`.

Obsolete: Use OcclusionEnabled instead.

Returns:bool

public bool Sandbox.SoundHandle.OcclusionEnabled { get; set; }PUBLICGETSET

Allow this sound to be occluded by geometry etc

Returns:bool

public float Sandbox.SoundHandle.OcclusionRadius { get; set; }PUBLICGETSETOBSOLETE

Legacy occlusion radius setting. No longer used by the simulation.

Obsolete: OcclusionRadius is no longer used by the simulation.

Returns:float

public Sandbox.GameObject Sandbox.SoundHandle.Parent { get; set; }PUBLICGETSET

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.

Returns:GameObject

public bool Sandbox.SoundHandle.Paused { get; set; }PUBLICGETSET

Whether the sound is currently paused or not.

Returns:bool

public float Sandbox.SoundHandle.Pitch { get; set; }PUBLICGETSET

Pitch of the sound.

Returns:float

public bool Sandbox.SoundHandle.Reflections { get; set; }PUBLICGETSETOBSOLETE

Legacy alias for `Sandbox.SoundHandle.ReverbEnabled`.

Obsolete: Use ReverbEnabled instead.

Returns:bool

public float Sandbox.SoundHandle.Reverb { get; set; }PUBLICGETSET

How much this sound contributes to room reverb. 1 = full reverb, 0 = completely dry.

Returns:float

public bool Sandbox.SoundHandle.ReverbEnabled { get; set; }PUBLICGETSET

Enable reverb simulation for this sound (reflections/late reverb).

Returns:bool

public int Sandbox.SoundHandle.SampleRate { get; set; }PUBLICGETSET

How many samples per second?

Returns:int

public float Sandbox.SoundHandle.SpacialBlend { get; set; }PUBLICGETSET

How 3d the sound should be. 0 means no 3d, 1 means fully

Returns:float

public Sandbox.Audio.Mixer Sandbox.SoundHandle.TargetMixer { get; set; }PUBLICGETSET

Which mixer do we want to write to

Returns:Mixer

public float Sandbox.SoundHandle.Time { get; set; }PUBLICGETSET

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.

Returns:float

public bool Sandbox.SoundHandle.Transmission { get; set; }PUBLICGETSET

Legacy transmission toggle. Transmission is now derived from occlusion and material response.

Returns:bool

public float Sandbox.SoundHandle.Volume { get; set; }PUBLICGETSET

Volume of the sound.

Returns:float

On this page

Methodspublic System.Void ClearParent()public virtual sealed System.Void Dispose()protected virtual override System.Void Finalize()public static System.Void GetActive(System.Collections.Generic.List`1<Sandbox.SoundHandle> handles)public System.Void SetParent(Sandbox.GameObject obj)public System.Void Stop(System.Single fadeTime = 0)public System.Void Update()Propertiespublic System.Boolean Sandbox.SoundHandle.AirAbsorption { get; set; }public System.Single Sandbox.SoundHandle.Amplitude { get; set; }public System.Single Sandbox.SoundHandle.Decibels { get; set; }public System.Single Sandbox.SoundHandle.Distance { get; set; }public System.Boolean Sandbox.SoundHandle.DistanceAttenuation { get; set; }public System.Single Sandbox.SoundHandle.ElapsedTime { get; set; }public Sandbox.Curve Sandbox.SoundHandle.Fadein { get; set; }public Sandbox.Curve Sandbox.SoundHandle.Fadeout { get; set; }public Sandbox.Curve Sandbox.SoundHandle.Falloff { get; set; }public System.Boolean Sandbox.SoundHandle.Finished { get; set; }public System.Boolean Sandbox.SoundHandle.FollowParent { get; set; }public System.Boolean Sandbox.SoundHandle.IsPlaying { get; set; }public System.Boolean Sandbox.SoundHandle.IsStopped { get; set; }public virtual sealed System.Boolean Sandbox.SoundHandle.IsValid { get; set; }public Sandbox.SoundHandle.LipSyncAccessor Sandbox.SoundHandle.LipSync { get; set; }public System.Boolean Sandbox.SoundHandle.ListenLocal { get; set; }public Transform Sandbox.SoundHandle.LocalTransform { get; set; }public System.Boolean Sandbox.SoundHandle.Loopback { get; set; }public System.String Sandbox.SoundHandle.Name { get; set; }public System.Boolean Sandbox.SoundHandle.Occlusion { get; set; }public System.Boolean Sandbox.SoundHandle.OcclusionEnabled { get; set; }public System.Single Sandbox.SoundHandle.OcclusionRadius { get; set; }public Sandbox.GameObject Sandbox.SoundHandle.Parent { get; set; }public System.Boolean Sandbox.SoundHandle.Paused { get; set; }public System.Single Sandbox.SoundHandle.Pitch { get; set; }public Vector3 Sandbox.SoundHandle.Position { get; set; }public System.Boolean Sandbox.SoundHandle.Reflections { get; set; }public System.Single Sandbox.SoundHandle.Reverb { get; set; }public System.Boolean Sandbox.SoundHandle.ReverbEnabled { get; set; }public Rotation Sandbox.SoundHandle.Rotation { get; set; }public System.Int32 Sandbox.SoundHandle.SampleRate { get; set; }public System.Single Sandbox.SoundHandle.SpacialBlend { get; set; }public Sandbox.Audio.Mixer Sandbox.SoundHandle.TargetMixer { get; set; }public System.Single Sandbox.SoundHandle.Time { get; set; }public Transform Sandbox.SoundHandle.Transform { get; set; }public System.Boolean Sandbox.SoundHandle.Transmission { get; set; }public System.Single Sandbox.SoundHandle.Volume { get; set; }Metadata