Vixen
02b45cc4
csharp
public sealed class StreamingSampleProvider

A voice source that is being decoded while it plays.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

What stops a five-minute track costing fifty megabytes of resident memory. The decoder runs on AudioStreamPump's thread and fills a ring buffer; the mixer drains that ring inside the audio callback and never touches the decoder, the file, or a lock.

An empty ring is silence and a counter, not a stall. If the pump has fallen behind — a slow disk, a stalled network read, a machine under load — Read writes zeros for the frames it could not fill and increments Underruns. The alternative is blocking the audio thread, which turns one late track into every sound in the game stuttering.

Fields and properties (7)

  • public AudioFormat Format

    The rate and channel count of what Read produces.

  • public long FrameCount

    How many frames there are in total, or -1 if that is not knowable.

  • public long Position

    Where the next Read will start, in frames.

  • public bool IsLooping

    Whether it will keep producing after it has run out.

  • public long Underruns

    How many times the mixer wanted frames the decoder had not produced yet.

  • public int BufferedFrames

    How many frames are decoded and waiting.

  • public bool IsExhausted

    Whether the decoder has reached the end and will produce nothing more.

Methods (5)

  • public StreamingSampleProvider(IAudioStreamDecoder decoder, bool loop = false, int bufferedFrames = 24000)

    A provider over a decoder.

  • public int Read(Span<float> destination, int frameCount)
  • public void Seek(long frame)

    Starts again from a frame.

  • public int Fill()

    Decodes until the ring is full or the track has ended.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (4)

  • VideoGameVideoPlayback
  • AudioEngineVixen.Audio
  • AudioStreamPumpVixen.Audio
  • StreamingTestsVixen.Audio.Tests