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.
Related Guides
Broader workflow and conceptual references connected to this API.
s&box provides several ways to play sounds in code. You can fire-and-forget a sound at a world position, control it via a SoundHandle, attach it to a GameObject, or use scene components entirely.
s&box has a full audio system including 2D/3D sound playback, voice chat, positional audio, an audio effects pipeline, and lip sync support.
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
No results match this filter.
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 Sandbox.SoundHandle.LipSyncAccessor Sandbox.SoundHandle.LipSync { get; set; }
Access lipsync processing.
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 Vector3 Sandbox.SoundHandle.Position { get; set; }
Position of the sound.
public bool Sandbox.SoundHandle.Reflections { get; set; }Obsolete
Enable the sound reflecting off surfaces
Obsolete: This API member is obsolete.
public Rotation Sandbox.SoundHandle.Rotation { get; set; }
The direction the sound is facing
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 Transform Sandbox.SoundHandle.Transform { get; set; }
This sound's transform
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.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.SoundHandle |