Class SampleProvider3D
Namespace: ValveResourceFormat.Renderer.Audio.SampleProviders
Assembly: Renderer.dll
A positional sound with stereo panning and distance based attenuation. Attenuation follows SampleProvider3D.DistanceVolumeCurve when set, then SampleProvider3D.DistanceMult, otherwise a simple exponential falloff over SampleProvider3D.Range.
public class SampleProvider3D : SampleProviderSpatial, IAudioSampleProviderInheritance
object ← AudioSampleProvider ← SampleProvider2D ← SampleProviderSpatial ← SampleProvider3D
Implements
Inherited Members
SampleProviderSpatial.LeftVolume, SampleProviderSpatial.RightVolume, SampleProviderSpatial.LastLeftVolume, SampleProviderSpatial.LastRightVolume, SampleProviderSpatial.Read(float[], int, int), SampleProviderSpatial.Update(in ListenerState), SampleProviderSpatial.SnapVolumesOnFirstUpdate(), SampleProviderSpatial.ResetInterpolation(), SampleProvider2D.Provider, SampleProvider2D.Read(float[], int, int), AudioSampleProvider.OnOver, AudioSampleProvider.Volume, AudioSampleProvider.VolumeMultiplier, AudioSampleProvider.Read(float[], int, int), AudioSampleProvider.Over()
Constructors
SampleProvider3D(IAudioSampleProvider)
Creates a positional provider around the given source.
public SampleProvider3D(IAudioSampleProvider provider)Parameters
provider IAudioSampleProvider
Properties
DistanceMult
Gets or sets the reciprocal of the distance this sound stays at full volume out to, past which it follows the inverse distance law (halving in amplitude per doubling of distance) instead of running out of range - derived from a sound level (see SoundscapeOperatorParsing.SoundLevelToDistanceMult). Zero attenuates nothing at all (SNDLVL_NONE), null leaves attenuation to the curve or to SampleProvider3D.Range.
public float? DistanceMult { get; set; }Property Value
float?
DistanceVolumeCurve
Gets or sets the distance to volume mapping curve ("distance_volume_mapping_curve").
public SoundEventCurve? DistanceVolumeCurve { get; set; }Property Value
DopplerScale
Gets or sets how strongly the doppler shift applies, 0 to disable it. The shift itself comes from how fast the listener and this sound close on each other; scaling past 1 exaggerates it.
public float DopplerScale { get; set; }Property Value
float
OcclusionTarget
Gets or sets the attenuation to move towards while geometry blocks the sound (1 unoccluded, 0 fully muted). The applied value is smoothed across updates.
public float OcclusionTarget { get; set; }Property Value
float
OutOfRange
Gets whether the listener was outside the audible range during the last update.
public bool OutOfRange { get; }Property Value
bool
Position
Gets or sets the world position of the sound.
public Vector3 Position { get; set; }Property Value
Range
Gets or sets the audible range used by the fallback falloff when no volume curve or distance multiplier is set.
public float Range { get; set; }Property Value
float
StereoMixCurve
Gets or sets the distance to unfiltered-stereo mapping curve ("distance_unfiltered_stereo_mapping_curve"). At 1 the sound plays as plain centered stereo, at 0 it is fully spatialized.
public SoundEventCurve? StereoMixCurve { get; set; }Property Value
Methods
ResetInterpolation()
Resets the interpolation state so the next update snaps to its target instead of fading in from wherever this provider last left off. Call when reusing this instance for a new (e.g. retriggered) sound.
public override void ResetInterpolation()Update(in ListenerState)
Recomputes the per-ear volumes for the given listener, through SampleProviderSpatial.ApplyPanning. Returns whether the sound is currently audible.
public override bool Update(in ListenerState listener)Parameters
listener ListenerState
Returns
bool

