Class SoundCache
Namespace: ValveResourceFormat.Renderer.Audio
Assembly: Renderer.dll
Loads compiled sound resources (vsnd) and caches them decoded in the mixer's output format.
returns a placeholder immediately; decoding happens on worker threads.public sealed class SoundCache : IDisposableInheritance
Implements
Constructors
SoundCache(IFileLoader, int, int, ILogger)
Creates a sound cache that decodes into the given output format.
public SoundCache(IFileLoader fileLoader, int sampleRate, int channels, ILogger logger)Parameters
fileLoader IFileLoader
sampleRate int
channels int
logger ILogger
Properties
CachedBytes
Gets the total size of the decoded audio currently held.
public long CachedBytes { get; }Property Value
MaxCachedBytes
Gets or sets the soft cache budget in bytes. Least recently used idle sounds are evicted once the total exceeds this; sounds currently playing or below are never evicted.
public long MaxCachedBytes { get; set; }Property Value
PendingDecodes
Gets how many sounds are still waiting to be decoded, across both lanes.
public int PendingDecodes { get; }Property Value
Methods
Dispose()
Stops the decode threads.
public void Dispose()GetSound(string, bool)
Gets a sound by file name, decoding it if necessary. Returns immediately with a placeholder if not yet decoded; foreground requests jump ahead of pending background requests in the queue.
public CachedSound GetSound(string fileName, bool background = false)Parameters
fileName string
background bool

