Table of Contents

Class AsioAudioCapturedEventArgs

Namespace
NAudio.Wave
Assembly
NAudio.Asio.dll

Event args for AudioCaptured. Exposes one converted float span per selected input channel, plus a zero-copy raw escape hatch. Valid only for the duration of the event handler invocation.

public sealed class AsioAudioCapturedEventArgs : EventArgs
Inheritance
AsioAudioCapturedEventArgs
Inherited Members

Properties

ChannelCount

Number of input channels selected at init time.

public int ChannelCount { get; }

Property Value

int

Frames

Number of audio frames per channel in this callback.

public int Frames { get; }

Property Value

int

SamplePosition

Position of the first frame in this buffer, in frames since the driver started, as reported by the driver. Zero if the driver did not report a position for this callback.

public long SamplePosition { get; }

Property Value

long

SampleRate

Sample rate the driver is currently running at, in Hz.

public int SampleRate { get; }

Property Value

int

Speed

Varispeed factor reported by the driver (1.0 = nominal). Most drivers report 1.0; non-1.0 values appear when the driver is doing pull-up/pull-down (29.97 vs 30 fps film transfer) or external rate adaptation.

public double Speed { get; }

Property Value

double

SystemTimeNanoseconds

Host system time, in nanoseconds, corresponding to SamplePosition. This pins the audio clock to the host clock at one precise instant per buffer — use it for A/V sync, drift correction against Stopwatch, or aligning multiple ASIO devices. Zero if the driver did not report a timestamp for this callback.

public long SystemTimeNanoseconds { get; }

Property Value

long

TimeCode

SMPTE/MTC time code from an external source (LTC input, MTC over MIDI, etc.) corresponding to this buffer. null when no external time-code source is connected — the common case.

public AsioTimeCodeInfo? TimeCode { get; }

Property Value

AsioTimeCodeInfo?

Methods

GetChannel(int)

Gets a read-only span of converted float samples for the specified channel.

public ReadOnlySpan<float> GetChannel(int channelIndex)

Parameters

channelIndex int

Zero-based index into the selected-inputs array, not the physical channel index. Valid range: 0 to ChannelCount - 1.

Returns

ReadOnlySpan<float>

A span of length Frames. Valid only for the duration of the event handler.

RawInput(int)

Zero-copy access to the specified channel in the driver's native sample format.

public AsioRawInputBuffer RawInput(int channelIndex)

Parameters

channelIndex int

Zero-based index into the selected-inputs array.

Returns

AsioRawInputBuffer