Delegate CaptureDataAvailableHandler
Delegate for zero-copy capture data events. The buffer is a ReadOnlySpan<T> directly over the WASAPI buffer — only valid for the duration of the callback.
public delegate void CaptureDataAvailableHandler(ReadOnlySpan<byte> buffer, AudioClientBufferFlags flags, long devicePosition, long qpcPosition)
Parameters
bufferReadOnlySpan<byte>The captured audio data. Copy it if you need to keep it.
flagsAudioClientBufferFlagsBuffer flags from WASAPI (e.g. Silent).
devicePositionlongThe device position (in frames) at the start of this packet, as reported by
IAudioCaptureClient::GetBuffer. Useful for detecting gaps and aligning packets.qpcPositionlongThe QPC (QueryPerformanceCounter) value at the time the packet was captured, in 100-nanosecond units. Use it to time-align captured audio against a wall clock.