public sealed class AudioStreamPumpThe one thread that keeps every streaming voice's buffer topped up.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
One thread for all of them, not one per track. A game plays music, ambience and perhaps a dialogue line at once — three streams, and three threads that spend almost all of their time asleep. Decoding half a second of Opus takes single-digit milliseconds; one thread servicing every stream in round-robin has room for dozens before it is the bottleneck, and it makes "how far behind is streaming" a single answerable question.
It is also not required. Pump is public and does the whole job synchronously, so a test drives it frame by frame and a single-threaded platform — a browser without threads, which is where docs/plan/10 puts the web target — calls it from its own loop instead of starting anything.
Fields and properties (3)
public TimeSpan IntervalHow long the thread sleeps between passes.
public int StreamCountHow many streams it is servicing.
public bool IsRunningWhether its thread is running.
Methods (6)
public void Register(StreamingSampleProvider provider)Takes on a stream, and fills it once before returning.
public void Unregister(StreamingSampleProvider provider)Stops servicing a stream.
public int Pump()Fills every registered stream as far as it will go.
public void Start()Starts the thread.
public void Stop()Stops the thread and waits for it.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- VideoGameVideoPlayback
- AudioEngineVixen.Audio
- StreamingTestsVixen.Audio.Tests