Class CachedSoundSampleProvider
Namespace: ValveResourceFormat.Renderer.Audio.SampleProviders
Assembly: Renderer.dll
Streams samples out of a , honoring its loop points. Supports pitch shifting by resampling at a fractional playback rate.
public sealed class CachedSoundSampleProvider : AudioSampleProvider, IAudioSampleProviderInheritance
object ← AudioSampleProvider ← CachedSoundSampleProvider
Implements
Inherited Members
AudioSampleProvider.OnOver, AudioSampleProvider.Volume, AudioSampleProvider.Read(float[], int, int)
Constructors
CachedSoundSampleProvider(CachedSound)
Creates a provider that streams the given cached sound from the beginning.
public CachedSoundSampleProvider(CachedSound sound)Parameters
sound CachedSound
Properties
DelaySamples
Gets or sets the delay before the sound starts, as an interleaved sample count. A negative value instead seeks that many samples ahead into the track (wrapping within its loop region, or its full length when it does not loop) - used to phase-stagger otherwise-identical looping tracks (e.g. quad-channel ambient beds) so they do not all loop in lockstep.
public int DelaySamples { get; set; }Property Value
Pitch
Gets or sets the playback rate multiplier: 1 is normal speed, higher is faster and higher pitched.
public float Pitch { get; set; }Property Value
Methods
Read(float[], int, int)
Fills buffer with up to count samples starting at offset. Returns the number of samples written. A return value smaller than count signals the end of the sound.
public override int Read(float[] buffer, int offset, int count)Parameters
buffer float[]
offset int
count int
Returns
Reset(CachedSound)
Rebinds this provider to newSound and restarts playback from the beginning. Lets a retriggering sound event reuse the same provider instead of allocating a new one every time.
public void Reset(CachedSound newSound)Parameters
newSound CachedSound

