Class AudioCaptureClient
- Namespace
- NAudio.CoreAudioApi
- Assembly
- NAudio.Wasapi.dll
Audio Capture Client
public class AudioCaptureClient : IDisposable
- Inheritance
-
AudioCaptureClient
- Implements
- Inherited Members
Methods
Dispose()
Dispose
public void Dispose()
GetBuffer(out int, out AudioClientBufferFlags)
Gets a pointer to the buffer
public nint GetBuffer(out int numFramesToRead, out AudioClientBufferFlags bufferFlags)
Parameters
numFramesToReadintNumber of frames to read
bufferFlagsAudioClientBufferFlagsBuffer flags
Returns
- nint
Pointer to the buffer
GetBuffer(out int, out AudioClientBufferFlags, out long, out long)
Gets a pointer to the buffer
public nint GetBuffer(out int numFramesToRead, out AudioClientBufferFlags bufferFlags, out long devicePosition, out long qpcPosition)
Parameters
numFramesToReadintbufferFlagsAudioClientBufferFlagsdevicePositionlongqpcPositionlong
Returns
- nint
Pointer to the buffer
GetBufferLease(int)
Gets a read-only Span over the WASAPI capture buffer. The returned lease must be disposed (which calls ReleaseBuffer) before the next call to GetBuffer. Read audio data directly from Buffer to avoid copies.
public CaptureBufferLease GetBufferLease(int bytesPerFrame)
Parameters
bytesPerFrameintBytes per frame (WaveFormat.BlockAlign)
Returns
- CaptureBufferLease
A lease that provides a read-only Span and releases the buffer on dispose
GetNextPacketSize()
Gets the size of the next packet
public int GetNextPacketSize()
Returns
ReleaseBuffer(int)
Release buffer
public void ReleaseBuffer(int numFramesRead)
Parameters
numFramesReadintNumber of frames read