public sealed class NullAudioCaptureDeviceA microphone with nobody in front of it, which something has to write into.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The same argument as NullAudioBackend, pointed the other way. A dedicated server has no microphone and still runs the code that reads one, and a CI machine has none either — so "no input" has to be an ordinary state rather than a null reference somewhere in the voice path.
Push is what makes it a test double rather than a stub. Every claim about the capture path — that a reader gets what the device produced, that a slow reader loses the oldest audio and says so, that monitoring plays back what came in — is a claim about buffering and hand-off, and none of it needs a real microphone to be true. What a real microphone adds is a driver, and a driver is not what those assertions are about.
Fields and properties (5)
public AudioDeviceInfo InfoWhich device this is.
public AudioFormat FormatThe format it was actually opened in.
public bool IsRunningWhether it is currently capturing.
public int AvailableHow many frames are waiting to be read.
public long OverrunsHow many frames were thrown away because nobody read them in time.
Methods (6)
public NullAudioCaptureDevice(in AudioCaptureOptions options)A device that captures whatever is pushed into it.
public void Start()Starts capturing. Anything captured before the first Read is buffered.
public void Stop()Stops capturing. Starting again is legal.
public int Push(ReadOnlySpan<float> samples)Pretends the microphone heard something.
public int Read(Span<float> destination, int frameCount)Takes what has been captured.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- CaptureTestsVixen.Audio.Tests
- LayeredEventTestsVixen.Audio.Tests
- NullAudioBackendVixen.Audio