Table of Contents

Class AsioDriver

Namespace
NAudio.Wave.Asio
Assembly
NAudio.Asio.dll

Main AsioDriver Class. To use this class, you need to query first the GetAsioDriverNames() and then use the GetAsioDriverByName to instantiate the correct AsioDriver. This is the first AsioDriver binding fully implemented in C#!

Contributor: Alexandre Mutel - email: alexandre_mutel at yahoo.fr

public class AsioDriver
Inheritance
AsioDriver
Inherited Members

Methods

CanSampleRate(double)

Determines whether this instance can use the specified sample rate.

public bool CanSampleRate(double sampleRate)

Parameters

sampleRate double

The sample rate.

Returns

bool

true if this instance [can sample rate] the specified sample rate; otherwise, false.

ControlPanel()

Controls the panel.

public void ControlPanel()

CreateBuffers(nint, int, int, ref AsioCallbacks)

Creates the buffers.

public void CreateBuffers(nint bufferInfos, int numChannels, int bufferSize, ref AsioCallbacks callbacks)

Parameters

bufferInfos nint

The buffer infos.

numChannels int

The num channels.

bufferSize int

Size of the buffer.

callbacks AsioCallbacks

The callbacks.

DisposeBuffers()

Disposes the buffers.

public AsioError DisposeBuffers()

Returns

AsioError

Future(int, nint)

Futures the specified selector.

public void Future(int selector, nint opt)

Parameters

selector int

The selector.

opt nint

The opt.

GetAsioDriverByGuid(Guid)

Instantiate the ASIO driver by GUID.

public static AsioDriver GetAsioDriverByGuid(Guid guid)

Parameters

guid Guid

The GUID.

Returns

AsioDriver

an AsioDriver instance

GetAsioDriverByName(string)

Instantiate a AsioDriver given its name.

public static AsioDriver GetAsioDriverByName(string name)

Parameters

name string

The name of the driver

Returns

AsioDriver

an AsioDriver instance

GetAsioDriverNames()

Gets the ASIO driver names installed.

public static string[] GetAsioDriverNames()

Returns

string[]

a list of driver names. Use this name to GetAsioDriverByName

GetBufferSize(out int, out int, out int, out int)

Gets the size of the buffer.

public void GetBufferSize(out int minSize, out int maxSize, out int preferredSize, out int granularity)

Parameters

minSize int

Size of the min.

maxSize int

Size of the max.

preferredSize int

Size of the preferred.

granularity int

The granularity.

GetChannelInfo(int, bool)

Gets the channel info.

public AsioChannelInfo GetChannelInfo(int channelNumber, bool trueForInputInfo)

Parameters

channelNumber int

The channel number.

trueForInputInfo bool

if set to true [true for input info].

Returns

AsioChannelInfo

Channel Info

GetChannels(out int, out int)

Gets the number of channels.

public void GetChannels(out int numInputChannels, out int numOutputChannels)

Parameters

numInputChannels int

The num input channels.

numOutputChannels int

The num output channels.

GetClockSources(int)

Enumerates the clock sources available to the driver (Internal, Word Clock, S/PDIF, ADAT, …). Each entry's IsCurrentSource indicates whether the driver is currently locked to it; the Index is the value to pass to SetClockSource(int). The driver may signal kAsioResetRequest in response to a clock-source change, which surfaces via AsioDevice.DriverResetRequest.

public AsioClockSource[] GetClockSources(int maxSources = 16)

Parameters

maxSources int

Upper bound on the number of sources to retrieve. 16 is generous — even high-end interfaces rarely report more than 8.

Returns

AsioClockSource[]

GetDriverName()

Gets the name of the driver.

public string GetDriverName()

Returns

string

GetDriverVersion()

Gets the driver version.

public int GetDriverVersion()

Returns

int

GetErrorMessage()

Gets the error message.

public string GetErrorMessage()

Returns

string

GetLatencies(out int, out int)

Gets the latencies (n.b. does not throw an exception)

public AsioError GetLatencies(out int inputLatency, out int outputLatency)

Parameters

inputLatency int

The input latency.

outputLatency int

The output latency.

Returns

AsioError

GetSamplePosition(out Asio64Bit, out Asio64Bit)

Gets the current sample position and the host system time (in nanoseconds) at which it was sampled.

public void GetSamplePosition(out Asio64Bit samplePos, out Asio64Bit timeStamp)

Parameters

samplePos Asio64Bit

Sample position since Start(), as a 64-bit ASIO value.

timeStamp Asio64Bit

System time in nanoseconds corresponding to samplePos.

GetSampleRate()

Gets the sample rate.

public double GetSampleRate()

Returns

double

Init(nint)

Inits the AsioDriver..

public bool Init(nint sysHandle)

Parameters

sysHandle nint

The sys handle.

Returns

bool

OutputReady()

Notifies OutputReady to the AsioDriver.

public AsioError OutputReady()

Returns

AsioError

ReleaseComAsioDriver()

Releases this instance.

public void ReleaseComAsioDriver()

SetClockSource(int)

Sets the clock source. Use one of the Index values returned by GetClockSources(int).

public void SetClockSource(int reference)

Parameters

reference int

Clock source index reported by the driver.

SetSampleRate(double)

Sets the sample rate.

public void SetSampleRate(double sampleRate)

Parameters

sampleRate double

The sample rate.

Start()

Starts this instance.

public void Start()

Stop()

Stops this instance.

public AsioError Stop()

Returns

AsioError