Soundclass

Single source for creating sounds

objectSound
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public static abstract sealed class Sandbox.Sound

Methods12

Showing 12 methods

public static void Preload(string eventName)PUBLICSTATIC

Precaches sound files associated with given sound event by name. This helps avoid stutters on first load of each sound file.

ParameterTypeDescription
eventNamestring
Returns:void

public static void SetEffect(string name, float value, float velocity = 10, float fadeOut = -1)PUBLICSTATICOBSOLETE

Obsolete: This API member is obsolete.

ParameterTypeDescription
namestring
valuefloat
velocity = 10float
fadeOut = -1float
Returns:void

public static void StopAll(float fade)PUBLICSTATIC

ParameterTypeDescription
fadefloat
Returns:void

public static void UncompressVoiceData(byte[] buffer, System.Action`1<System.Memory`1<short>> ondata)PUBLICSTATIC

ParameterTypeDescription
bufferbyte[]
ondataAction<Memory<short>>
Returns:void

Properties4

Showing 4 properties

public static string[] Sandbox.Sound.DspNames { get; set; }PUBLICSTATICGETSET

Get a list of available DSP names

Returns:string[]

public static Transform Sandbox.Sound.Listener { get; set; }PUBLICSTATICGETSET

Sound listener of the active scene.

Returns:Transform

public static float Sandbox.Sound.MasterVolume { get; set; }PUBLICSTATICGETSET

The user's preference for their master volume.

Returns:float

public static int Sandbox.Sound.VoiceSampleRate { get; set; }PUBLICSTATICGETSET

The sample rate for voice data

Returns:int

On this page

Methodspublic static Sandbox.SoundHandle Play(Sandbox.SoundEvent soundEvent, Sandbox.Audio.Mixer mixer)public static Sandbox.SoundHandle Play(Sandbox.SoundEvent soundEvent, System.Single fadeInTime = 0)public static Sandbox.SoundHandle Play(Sandbox.SoundEvent soundEvent, Vector3 position, System.Single fadeInTime = 0)public static Sandbox.SoundHandle Play(System.String eventName, Sandbox.Audio.Mixer mixer)public static Sandbox.SoundHandle Play(System.String eventName, System.Single fadeInTime = 0)public static Sandbox.SoundHandle Play(System.String eventName, Vector3 position, System.Single fadeInTime = 0)public static Sandbox.SoundHandle PlayFile(Sandbox.SoundFile soundFile, System.Single volume, System.Single pitch, System.Single decibels, System.Single delay, System.Single fadeInTime = 0)public static Sandbox.SoundHandle PlayFile(Sandbox.SoundFile soundFile, System.Single volume = 1, System.Single pitch = 1, System.Single delay = 0, System.Single fadeInTime = 0)public static System.Void Preload(System.String eventName)public static System.Void SetEffect(System.String name, System.Single value, System.Single velocity = 10, System.Single fadeOut = -1)public static System.Void StopAll(System.Single fade)public static System.Void UncompressVoiceData(System.Byte[] buffer, System.Action`1<System.Memory`1<System.Int16>> ondata)Propertiespublic static System.String[] Sandbox.Sound.DspNames { get; set; }public static Transform Sandbox.Sound.Listener { get; set; }public static System.Single Sandbox.Sound.MasterVolume { get; set; }public static System.Int32 Sandbox.Sound.VoiceSampleRate { get; set; }Metadata