Xeno-rat
Loading...
Searching...
No Matches
NAudio.Wave.Asio.AsioDriverExt Class Reference

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. More...

Collaboration diagram for NAudio.Wave.Asio.AsioDriverExt:

Public Member Functions

 AsioDriverExt (AsioDriver driver)
 Initializes a new instance of the AsioDriverExt class based on an already instantiated AsioDriver instance.
 
void SetChannelOffset (int outputChannelOffset, int inputChannelOffset)
 Sets the channel offsets for output and input channels.
 
void Start ()
 Starts the driver.
 
void Stop ()
 Stops the driver.
 
void ShowControlPanel ()
 Shows the control panel by invoking the driver's ControlPanel method.
 
void ReleaseDriver ()
 Releases the driver resources and COM ASIO driver.
 
bool IsSampleRateSupported (double sampleRate)
 Checks if the specified sample rate is supported by the driver.
 
void SetSampleRate (double sampleRate)
 Sets the sample rate for the driver and updates the capabilities.
 
int CreateBuffers (int numberOfOutputChannels, int numberOfInputChannels, bool useMaxBufferSize)
 Creates buffers for the specified number of output and input channels and returns the buffer size used.
 

Public Attributes

Action ResetRequestCallback
 

Properties

AsioDriver Driver [get]
 Gets the driver used.
 
AsioFillBufferCallback FillBufferCallback [get, set]
 Gets or sets the fill buffer callback.
 
AsioDriverCapability Capabilities [get]
 Gets the capabilities of the AsioDriver.
 

Private Member Functions

void BuildCapabilities ()
 Builds the capabilities of the ASIO driver, including driver name, input/output channels, channel information, sample rate, latencies, and buffer size.
 
void BufferSwitchCallBack (int doubleBufferIndex, bool directProcess)
 Callback function for switching buffers and invoking the fill buffer callback.
 
void SampleRateDidChangeCallBack (double sRate)
 Updates the sample rate in the capability and modifies the original array in place.
 
int AsioMessageCallBack (AsioMessageSelector selector, int value, IntPtr message, IntPtr opt)
 Handles ASIO messages and performs corresponding actions based on the message selector and value.
 
IntPtr BufferSwitchTimeInfoCallBack (IntPtr asioTimeParam, int doubleBufferIndex, bool directProcess)
 Callback function for switching buffer time information.
 

Private Attributes

readonly AsioDriver driver
 
AsioCallbacks callbacks
 
AsioDriverCapability capability
 
AsioBufferInfo[] bufferInfos
 
bool isOutputReadySupported
 
IntPtr[] currentOutputBuffers
 
IntPtr[] currentInputBuffers
 
int numberOfOutputChannels
 
int numberOfInputChannels
 
AsioFillBufferCallback fillBufferCallback
 
int bufferSize
 
int outputChannelOffset
 
int inputChannelOffset
 

Detailed Description

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

Constructor & Destructor Documentation

◆ AsioDriverExt()

NAudio.Wave.Asio.AsioDriverExt.AsioDriverExt ( AsioDriver driver)
inline

Initializes a new instance of the AsioDriverExt class based on an already instantiated AsioDriver instance.

Parameters
driverA AsioDriver already instantiated.
Here is the call graph for this function:

Member Function Documentation

◆ AsioMessageCallBack()

int NAudio.Wave.Asio.AsioDriverExt.AsioMessageCallBack ( AsioMessageSelector selector,
int value,
IntPtr message,
IntPtr opt )
inlineprivate

Handles ASIO messages and performs corresponding actions based on the message selector and value.

Parameters
selectorThe ASIO message selector.
valueThe value associated with the message selector.
messageA pointer to the message data.
optA pointer to optional data.
Returns
The result of the ASIO message handling.

This method handles ASIO messages and performs corresponding actions based on the message selector and value. It switches between different message selectors and executes the appropriate actions for each case. If the message selector is kAsioSelectorSupported, it further switches between sub-values to handle specific cases. The method also invokes the ResetRequestCallback when the message selector is kAsioResetRequest.

Here is the caller graph for this function:

◆ BufferSwitchCallBack()

void NAudio.Wave.Asio.AsioDriverExt.BufferSwitchCallBack ( int doubleBufferIndex,
bool directProcess )
inlineprivate

Callback function for switching buffers and invoking the fill buffer callback.

Parameters
doubleBufferIndexThe index of the double buffer.
directProcessA boolean value indicating whether to process directly.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BufferSwitchTimeInfoCallBack()

IntPtr NAudio.Wave.Asio.AsioDriverExt.BufferSwitchTimeInfoCallBack ( IntPtr asioTimeParam,
int doubleBufferIndex,
bool directProcess )
inlineprivate

Callback function for switching buffer time information.

Parameters
asioTimeParamThe time parameter for the ASIO driver.
doubleBufferIndexThe index of the double buffer.
directProcessA boolean value indicating whether the process is direct.
Returns
Returns a pointer to the buffer switch time information.
Here is the caller graph for this function:

◆ BuildCapabilities()

void NAudio.Wave.Asio.AsioDriverExt.BuildCapabilities ( )
inlineprivate

Builds the capabilities of the ASIO driver, including driver name, input/output channels, channel information, sample rate, latencies, and buffer size.

This method initializes the capability object with the capabilities of the ASIO driver. It retrieves the driver name using AsioDriver.GetDriverName and the number of input/output channels using AsioDriver.GetChannels. It then retrieves the channel information for inputs and outputs using AsioDriver.GetChannelInfo. The sample rate is obtained using AsioDriver.GetSampleRate, and latencies are retrieved using AsioDriver.GetLatencies. If an error occurs during the retrieval of latencies, an AsioException is thrown with the specific error information. Finally, the buffer size is obtained using AsioDriver.GetBufferSize.

Exceptions
AsioExceptionThrown when an error occurs during the retrieval of latencies.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateBuffers()

int NAudio.Wave.Asio.AsioDriverExt.CreateBuffers ( int numberOfOutputChannels,
int numberOfInputChannels,
bool useMaxBufferSize )
inline

Creates buffers for the specified number of output and input channels and returns the buffer size used.

Parameters
numberOfOutputChannelsThe number of output channels for which buffers need to be created.
numberOfInputChannelsThe number of input channels for which buffers need to be created.
useMaxBufferSizeA boolean value indicating whether to use the maximum buffer size provided by the driver.
Exceptions
ArgumentExceptionThrown when the number of output channels or input channels is invalid, i.e., not within the specified range.
Returns
The size of the buffers created for the channels, based on whether the maximum buffer size provided by the driver is used or the preferred buffer size.

This method creates buffers for the specified number of output and input channels. It sets the number of output and input channels and initializes buffer information accordingly. If useMaxBufferSize is true, the driver's maximum buffer size is used; otherwise, the preferred buffer size is used. The ASIO Buffers are created with the specified buffer information and callbacks, and the method checks if outputReady is supported by the driver.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsSampleRateSupported()

bool NAudio.Wave.Asio.AsioDriverExt.IsSampleRateSupported ( double sampleRate)
inline

Checks if the specified sample rate is supported by the driver.

Parameters
sampleRateThe sample rate to be checked.
Returns
True if the sample rate is supported; otherwise, false.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReleaseDriver()

void NAudio.Wave.Asio.AsioDriverExt.ReleaseDriver ( )
inline

Releases the driver resources and COM ASIO driver.

This method releases the driver resources by disposing the buffers and releasing the COM ASIO driver.

Exceptions
ExceptionThrown if an error occurs while disposing the buffers.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleRateDidChangeCallBack()

void NAudio.Wave.Asio.AsioDriverExt.SampleRateDidChangeCallBack ( double sRate)
inlineprivate

Updates the sample rate in the capability and modifies the original array in place.

Parameters
sRateThe new sample rate value.

This method updates the sample rate in the capability object with the provided sRate value.

Here is the caller graph for this function:

◆ SetChannelOffset()

void NAudio.Wave.Asio.AsioDriverExt.SetChannelOffset ( int outputChannelOffset,
int inputChannelOffset )
inline

Sets the channel offsets for output and input channels.

Parameters
outputChannelOffsetThe offset for the output channels.
inputChannelOffsetThe offset for the input channels.
Exceptions
ArgumentExceptionThrown when the sum of outputChannelOffset and numberOfOutputChannels is greater than the number of output channels in the capabilities.
ArgumentExceptionThrown when the sum of inputChannelOffset and numberOfInputChannels is greater than the number of input channels in the capabilities.
Here is the caller graph for this function:

◆ SetSampleRate()

void NAudio.Wave.Asio.AsioDriverExt.SetSampleRate ( double sampleRate)
inline

Sets the sample rate for the driver and updates the capabilities.

Parameters
sampleRateThe new sample rate to be set.

This method sets the sample rate for the driver to the specified value and then updates the capabilities by calling the BuildCapabilities method.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowControlPanel()

void NAudio.Wave.Asio.AsioDriverExt.ShowControlPanel ( )
inline

Shows the control panel by invoking the driver's ControlPanel method.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Start()

void NAudio.Wave.Asio.AsioDriverExt.Start ( )
inline

Starts the driver.

This method starts the driver, allowing it to perform its designated tasks.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stop()

void NAudio.Wave.Asio.AsioDriverExt.Stop ( )
inline

Stops the driver.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bufferInfos

AsioBufferInfo [] NAudio.Wave.Asio.AsioDriverExt.bufferInfos
private

◆ bufferSize

int NAudio.Wave.Asio.AsioDriverExt.bufferSize
private

◆ callbacks

AsioCallbacks NAudio.Wave.Asio.AsioDriverExt.callbacks
private

◆ capability

AsioDriverCapability NAudio.Wave.Asio.AsioDriverExt.capability
private

◆ currentInputBuffers

IntPtr [] NAudio.Wave.Asio.AsioDriverExt.currentInputBuffers
private

◆ currentOutputBuffers

IntPtr [] NAudio.Wave.Asio.AsioDriverExt.currentOutputBuffers
private

◆ driver

readonly AsioDriver NAudio.Wave.Asio.AsioDriverExt.driver
private

◆ fillBufferCallback

AsioFillBufferCallback NAudio.Wave.Asio.AsioDriverExt.fillBufferCallback
private

◆ inputChannelOffset

int NAudio.Wave.Asio.AsioDriverExt.inputChannelOffset
private

◆ isOutputReadySupported

bool NAudio.Wave.Asio.AsioDriverExt.isOutputReadySupported
private

◆ numberOfInputChannels

int NAudio.Wave.Asio.AsioDriverExt.numberOfInputChannels
private

◆ numberOfOutputChannels

int NAudio.Wave.Asio.AsioDriverExt.numberOfOutputChannels
private

◆ outputChannelOffset

int NAudio.Wave.Asio.AsioDriverExt.outputChannelOffset
private

◆ ResetRequestCallback

Action NAudio.Wave.Asio.AsioDriverExt.ResetRequestCallback

Property Documentation

◆ Capabilities

AsioDriverCapability NAudio.Wave.Asio.AsioDriverExt.Capabilities
get

Gets the capabilities of the AsioDriver.

The capabilities.

◆ Driver

AsioDriver NAudio.Wave.Asio.AsioDriverExt.Driver
get

Gets the driver used.

The ASIOdriver.

◆ FillBufferCallback

AsioFillBufferCallback NAudio.Wave.Asio.AsioDriverExt.FillBufferCallback
getset

Gets or sets the fill buffer callback.

The fill buffer callback.


The documentation for this class was generated from the following file: