NAudio.Asio
ASIO 64 bit value
Unfortunately the ASIO API was implemented it before compiler supported consistently 64 bit
integer types. By using the structure the data layout on a little-endian system like the
Intel x86 architecture will result in a "non native" storage of the 64 bit data. The most
significant 32 bit are stored first in memory, the least significant bits are stored in the
higher memory space. However each 32 bit is stored in the native little-endian fashion
most significant bits (Bits 32..63)
least significant bits (Bits 0..31)
ASIO Callbacks
ASIO Buffer Switch Callback
ASIO Sample Rate Did Change Callback
ASIO Message Callback
ASIO Buffer Switch Time Info Callback
Buffer switch callback
void (*bufferSwitch) (long doubleBufferIndex, AsioBool directProcess);
Sample Rate Changed callback
void (*sampleRateDidChange) (AsioSampleRate sRate);
ASIO Message callback
long (*asioMessage) (long selector, long value, void* message, double* opt);
ASIO Buffer Switch Time Info Callback
AsioTime* (*bufferSwitchTimeInfo) (AsioTime* params, long doubleBufferIndex, AsioBool directProcess);
ASIO Channel Info
on input, channel index
Is Input
Is Active
Channel Info
ASIO Sample Type
Name
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
Gets the ASIO driver names installed.
a list of driver names. Use this name to GetAsioDriverByName
Instantiate a AsioDriver given its name.
The name of the driver
an AsioDriver instance
Instantiate the ASIO driver by GUID.
The GUID.
an AsioDriver instance
Inits the AsioDriver..
The sys handle.
Gets the name of the driver.
Gets the driver version.
Gets the error message.
Starts this instance.
Stops this instance.
Gets the number of channels.
The num input channels.
The num output channels.
Gets the latencies (n.b. does not throw an exception)
The input latency.
The output latency.
Gets the size of the buffer.
Size of the min.
Size of the max.
Size of the preferred.
The granularity.
Determines whether this instance can use the specified sample rate.
The sample rate.
true if this instance [can sample rate] the specified sample rate; otherwise, false.
Gets the sample rate.
Sets the sample rate.
The sample rate.
Gets the clock sources.
The clocks.
The num sources.
Sets the clock source.
The reference.
Gets the sample position.
The sample pos.
The time stamp.
Gets the channel info.
The channel number.
if set to true [true for input info].
Channel Info
Creates the buffers.
The buffer infos.
The num channels.
Size of the buffer.
The callbacks.
Disposes the buffers.
Controls the panel.
Futures the specified selector.
The selector.
The opt.
Notifies OutputReady to the AsioDriver.
Releases this instance.
Handles the exception. Throws an exception based on the error.
The error to check.
Method name
Inits the vTable method from GUID. This is a tricky part of this class.
The ASIO GUID.
Internal VTable structure to store all the delegates to the C++ COM method.
AsioDriverCapability holds all the information from the AsioDriver.
Use AsioDriverExt to get the Capabilities
Drive Name
Number of Input Channels
Number of Output Channels
Input Latency
Output Latency
Buffer Minimum Size
Buffer Maximum Size
Buffer Preferred Size
Buffer Granularity
Sample Rate
Input Channel Info
Output Channel Info
Callback used by the AsioDriverExt to get wave data
AsioDriverExt is a simplified version of the AsioDriver. It provides an easier
way to access the capabilities of the Driver and implement the callbacks necessary
for feeding the driver.
Implementation inspired from Rob Philpot's with a managed C++ ASIO wrapper BlueWave.Interop.Asio
http://www.codeproject.com/KB/mcpp/Asio.Net.aspx
Contributor: Alexandre Mutel - email: alexandre_mutel at yahoo.fr
Initializes a new instance of the class based on an already
instantiated AsioDriver instance.
A AsioDriver already instantiated.
Allows adjustment of which is the first output channel we write to
Output Channel offset
Input Channel offset
Gets the driver used.
The ASIOdriver.
Starts playing the buffers.
Stops playing the buffers.
Shows the control panel.
Releases this instance.
Determines whether the specified sample rate is supported.
The sample rate.
true if [is sample rate supported]; otherwise, false.
Sets the sample rate.
The sample rate.
Gets or sets the fill buffer callback.
The fill buffer callback.
Gets the capabilities of the AsioDriver.
The capabilities.
Creates the buffers for playing.
The number of outputs channels.
The number of input channel.
if set to true [use max buffer size] else use Prefered size
Builds the capabilities internally.
Callback called by the AsioDriver on fill buffer demand. Redirect call to external callback.
Index of the double buffer.
if set to true [direct process].
Callback called by the AsioDriver on event "Samples rate changed".
The sample rate.
Asio message call back.
The selector.
The value.
The message.
The opt.
Buffers switch time info call back.
The asio time param.
Index of the double buffer.
if set to true [direct process].
ASIO Error Codes
This value will be returned whenever the call succeeded
unique success return value for ASIOFuture calls
hardware input or output is not present or available
hardware is malfunctioning (can be returned by any ASIO function)
input parameter invalid
hardware is in a bad mode or used in a bad mode
hardware is not running when sample position is inquired
sample clock or rate cannot be determined or is not present
not enough memory for completing the request
ASIO Message Selector
selector in <value>, returns 1L if supported,
returns engine (host) asio implementation version,
request driver reset. if accepted, this
not yet supported, will currently always return 0L.
the driver went out of sync, such that
the drivers latencies have changed. The engine
if host returns true here, it will expect the
supports timecode
unused - value: number of commands, message points to mmc commands
kAsioSupportsXXX return 1 if host supports this
unused and undefined
unused and undefined
unused and undefined
unused and undefined
driver detected an overload
This class stores convertors for different interleaved WaveFormat to ASIOSampleType separate channel
format.
Selects the sample convertor based on the input WaveFormat and the output ASIOSampleTtype.
The wave format.
The type.
Optimized convertor for 2 channels SHORT
Generic convertor for SHORT
Optimized convertor for 2 channels FLOAT
Generic convertor Float to INT
Optimized convertor for 2 channels INT to INT
Generic convertor INT to INT
Optimized convertor for 2 channels INT to SHORT
Generic convertor INT to SHORT
Generic convertor INT to FLOAT
Optimized convertor for 2 channels SHORT
Generic convertor for SHORT
Optimized convertor for 2 channels FLOAT
Generic convertor SHORT
Generic converter 24 LSB
Generic convertor for float
ASIO Sample Type
Int 16 MSB
Int 24 MSB (used for 20 bits as well)
Int 32 MSB
IEEE 754 32 bit float
IEEE 754 64 bit double float
32 bit data with 16 bit alignment
32 bit data with 18 bit alignment
32 bit data with 20 bit alignment
32 bit data with 24 bit alignment
Int 16 LSB
Int 24 LSB
used for 20 bits as well
Int 32 LSB
IEEE 754 32 bit float, as found on Intel x86 architecture
IEEE 754 64 bit double float, as found on Intel x86 architecture
32 bit data with 16 bit alignment
32 bit data with 18 bit alignment
32 bit data with 20 bit alignment
32 bit data with 24 bit alignment
DSD 1 bit data, 8 samples per byte. First sample in Least significant bit.
DSD 1 bit data, 8 samples per byte. First sample in Most significant bit.
DSD 8 bit data, 1 sample per byte. No Endianness required.
ASIO common Exception.
Gets the name of the error.
The error.
the name of the error
Raised when ASIO data has been recorded.
It is important to handle this as quickly as possible as it is in the buffer callback
Initialises a new instance of AsioAudioAvailableEventArgs
Pointers to the ASIO buffers for each channel
Pointers to the ASIO buffers for each channel
Number of samples in each buffer
Audio format within each buffer
Pointer to a buffer per input channel
Pointer to a buffer per output channel
Allows you to write directly to the output buffers
If you do so, set SamplesPerBuffer = true,
and make sure all buffers are written to with valid data
Set to true if you have written to the output buffers
If so, AsioOut will not read from its source
Number of samples in each buffer
Converts all the recorded audio into a buffer of 32 bit floating point samples, interleaved by channel
The samples as 32 bit floating point, interleaved
Audio format within each buffer
Most commonly this will be one of, Int32LSB, Int16LSB, Int24LSB or Float32LSB
Gets as interleaved samples, allocating a float array
The samples as 32 bit floating point values
ASIO Out Player. New implementation using an internal C# binding.
This implementation is only supporting Short16Bit and Float32Bit formats and is optimized
for 2 outputs channels .
SampleRate is supported only if AsioDriver is supporting it
This implementation is probably the first AsioDriver binding fully implemented in C#!
Original Contributor: Mark Heath
New Contributor to C# binding : Alexandre Mutel - email: alexandre_mutel at yahoo.fr
Playback Stopped
When recording, fires whenever recorded audio is available
Occurs when the driver settings are changed by the user, e.g. in the control panel.
Initializes a new instance of the class with the first
available ASIO Driver.
Initializes a new instance of the class with the driver name.
Name of the device.
Opens an ASIO output device
Device number (zero based)
Releases unmanaged resources and performs other cleanup operations before the
is reclaimed by garbage collection.
Dispose
Gets the names of the installed ASIO Driver.
an array of driver names
Determines whether ASIO is supported.
true if ASIO is supported; otherwise, false.
Determines whether this driver supports the specified sample rate.
The samplerate to check.
true if the specified sample rate is supported otherwise, false.
Inits the driver from the asio driver name.
Name of the driver.
Release driver
Shows the control panel
Starts playback
Stops playback
Pauses playback
Initialises to play
Source wave provider
Initialises to play, with optional recording
Source wave provider - set to null for record only
Number of channels to record
Specify sample rate here if only recording, ignored otherwise
driver buffer update callback to fill the wave buffer.
The input channels.
The output channels.
Gets the latency (in samples) of the playback driver
Automatically stop when the end of the input stream is reached
Disable this if auto-stop is causing hanging issues
A flag to let you know that we have reached the end of the input file
Useful if AutoStop is set to false
You can monitor this yourself and call Stop when it is true
Playback State
Driver Name
The number of output channels we are currently using for playback
(Must be less than or equal to DriverOutputChannelCount)
The number of input channels we are currently recording from
(Must be less than or equal to DriverInputChannelCount)
The maximum number of input channels this ASIO driver supports
The maximum number of output channels this ASIO driver supports
The number of samples per channel, per buffer.
By default the first channel on the input WaveProvider is sent to the first ASIO output.
This option sends it to the specified channel number.
Warning: make sure you don't set it higher than the number of available output channels -
the number of source channels.
n.b. Future NAudio may modify this
Input channel offset (used when recording), allowing you to choose to record from just one
specific input rather than them all
Sets the volume (1.0 is unity gain)
Not supported for ASIO Out. Set the volume on the input stream instead
Get the input channel name
channel index (zero based)
channel name
Get the output channel name
channel index (zero based)
channel name