s&box docs

public class Sandbox.SoundHandle

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

Broader workflow and conceptual references connected to this API.

Methods

Showing 7 methods

public void ClearParent()Obsolete

Clear our parent - stop following

Obsolete: Just use Parent property directly

public virtual sealed void Dispose()

protected virtual override void Finalize()

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

public void SetParent(Sandbox.GameObject obj)Obsolete

Tell the SoundHandle to follow this GameObject's position

Obsolete: Just use Parent property directly

public void Stop(float fadeTime = 0)

Parameters

  • fadeTime: Default: 0

public void Update()Obsolete

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

Properties

Showing 34 properties

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

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

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

Measure of audio loudness.

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

Obsolete: This is not used anymore

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

How many units the sound can be heard from.

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

Should the sound fade out over distance

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

Obsolete: Use Time instead

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

The fadein curve for when the sound starts.

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

The fadeout curve for when the sound stops.

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

The falloff curve for the sound.

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

Sound is done

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

Update our position every frame relative to our parent

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

Whether the sound is currently playing or not.

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

True if the sound has been stopped

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

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

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

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

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

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

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!

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

A debug name to help identify the sound

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

Allow this sound to be occluded by geometry etc

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

The radius of this sound's occlusion, allow for partial occlusion

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

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.

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

Whether the sound is currently paused or not.

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

Pitch of the sound.

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

Enable the sound reflecting off surfaces

Obsolete: This API member is obsolete.

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

How many samples per second?

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

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

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

Which mixer do we want to write to

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

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.

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

Should the sound transmit through walls, doors etc

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

Volume of the sound.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.SoundHandle

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.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 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