Struct AsioProcessBuffers
Per-callback view of input and output audio for a duplex AsioDevice session. Passed by reference to the user's AsioProcessCallback.
public readonly ref struct AsioProcessBuffers
- Inherited Members
Remarks
This is a ref struct: it lives on the stack and cannot outlive the buffer-switch callback.
All spans returned from it point into library-owned or driver-owned memory and are invalidated
the moment the callback returns. Do not capture any of these values across callbacks.
Properties
Frames
Number of audio frames per channel in this callback.
public int Frames { get; }
Property Value
InputChannelCount
Number of input channels selected at init time.
public int InputChannelCount { get; }
Property Value
OutputChannelCount
Number of output channels selected at init time.
public int OutputChannelCount { get; }
Property Value
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
SampleRate
Sample rate the driver is currently running at, in Hz.
public int SampleRate { get; }
Property Value
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
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
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
Methods
GetInput(int)
Gets a read-only span of converted float samples for the specified input channel.
public ReadOnlySpan<float> GetInput(int channelIndex)
Parameters
channelIndexintZero-based index into the selected-inputs array, not the physical channel index. Valid range:
0to InputChannelCount - 1.
Returns
- ReadOnlySpan<float>
A span of length Frames. Valid only for the duration of the callback.
GetOutput(int)
Gets a writable span for the specified output channel. Samples are converted to the driver's native format on callback return.
public Span<float> GetOutput(int channelIndex)
Parameters
channelIndexintZero-based index into the selected-outputs array, not the physical channel index. Valid range:
0to OutputChannelCount - 1.
Returns
RawInput(int)
Zero-copy access to the specified input channel in the driver's native sample format.
public AsioRawInputBuffer RawInput(int channelIndex)
Parameters
channelIndexintZero-based index into the selected-inputs array.
Returns
RawOutput(int)
Zero-copy access to the specified output channel in the driver's native sample format. Writing through this buffer bypasses float-to-native conversion and the unwritten-output clearing — the caller becomes responsible for writing every frame in this channel for this callback.
public AsioRawOutputBuffer RawOutput(int channelIndex)
Parameters
channelIndexintZero-based index into the selected-outputs array.