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#!
More...
|
bool | Init (IntPtr sysHandle) |
| Initializes the ASIO driver with the specified system handle.
|
|
string | GetDriverName () |
| Retrieves the name of the ASIO driver.
|
|
int | GetDriverVersion () |
| Gets the version of the driver.
|
|
string | GetErrorMessage () |
| Retrieves the error message from the ASIO driver and returns it as a string.
|
|
void | Start () |
| Starts the ASIO driver.
|
|
AsioError | Stop () |
| Stops the ASIO driver and returns any error that occurred during the operation.
|
|
void | GetChannels (out int numInputChannels, out int numOutputChannels) |
| Retrieves the number of input and output channels available.
|
|
AsioError | GetLatencies (out int inputLatency, out int outputLatency) |
| Retrieves the input and output latencies of the ASIO driver.
|
|
void | GetBufferSize (out int minSize, out int maxSize, out int preferredSize, out int granularity) |
| Retrieves the buffer size information from the ASIO driver.
|
|
bool | CanSampleRate (double sampleRate) |
| Checks if the specified sample rate is supported by the ASIO driver.
|
|
double | GetSampleRate () |
| Retrieves the sample rate from the ASIO driver.
|
|
void | SetSampleRate (double sampleRate) |
| Sets the sample rate for the ASIO driver.
|
|
void | GetClockSources (out long clocks, int numSources) |
| Retrieves the clock sources and outputs the result in the clocks parameter.
|
|
void | SetClockSource (int reference) |
| Sets the clock source for the ASIO driver.
|
|
void | GetSamplePosition (out long samplePos, ref Asio64Bit timeStamp) |
| Retrieves the current sample position and timestamp.
|
|
AsioChannelInfo | GetChannelInfo (int channelNumber, bool trueForInputInfo) |
| Retrieves the information about the specified channel.
|
|
void | CreateBuffers (IntPtr bufferInfos, int numChannels, int bufferSize, ref AsioCallbacks callbacks) |
| Creates buffers for audio input and output.
|
|
AsioError | DisposeBuffers () |
| Disposes the ASIO buffers and frees the allocated memory.
|
|
void | ControlPanel () |
| Opens the control panel for the ASIO driver.
|
|
void | Future (int selector, IntPtr opt) |
| Calls the ASIO driver's future function with the specified selector and options.
|
|
AsioError | OutputReady () |
| Checks if the output is ready and returns an AsioError.
|
|
void | ReleaseComAsioDriver () |
| Releases the COM object associated with the ASIO driver.
|
|
|
| AsioDriver () |
|
void | HandleException (AsioError error, string methodName) |
| Handles the exception for the ASIO method.
|
|
void | InitFromGuid (Guid asioGuid) |
| Initializes the ASIO driver from the given GUID and sets up the virtual table for method calls.
|
|
static int | CoCreateInstance (ref Guid clsid, IntPtr inner, uint context, ref Guid uuid, out IntPtr rReturnedComObject) |
| Creates a new instance of a COM object with the specified class identifier (CLSID).
|
|
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
◆ AsioDriver()
NAudio.Wave.Asio.AsioDriver.AsioDriver |
( |
| ) |
|
|
inlineprivate |
◆ CanSampleRate()
bool NAudio.Wave.Asio.AsioDriver.CanSampleRate |
( |
double | sampleRate | ) |
|
|
inline |
Checks if the specified sample rate is supported by the ASIO driver.
- Parameters
-
sampleRate | The sample rate to be checked. |
- Returns
- True if the sample rate is supported; otherwise, false.
- Exceptions
-
AsioException | Thrown when an error occurs while checking the sample rate. |
◆ CoCreateInstance()
static int NAudio.Wave.Asio.AsioDriver.CoCreateInstance |
( |
ref Guid | clsid, |
|
|
IntPtr | inner, |
|
|
uint | context, |
|
|
ref Guid | uuid, |
|
|
out IntPtr | rReturnedComObject ) |
|
private |
Creates a new instance of a COM object with the specified class identifier (CLSID).
- Parameters
-
clsid | The CLSID of the object to be created. |
inner | A pointer to the controlling IUnknown interface if the object is being created as part of an aggregate, or IntPtr.Zero otherwise. |
context | The execution context in which the code is to run. |
uuid | The IID of the interface on the object that the caller wants to communicate with. |
rReturnedComObject | When this method returns, contains a reference to the created object. |
- Returns
- An HRESULT value indicating success or failure.
◆ ControlPanel()
void NAudio.Wave.Asio.AsioDriver.ControlPanel |
( |
| ) |
|
|
inline |
Opens the control panel for the ASIO driver.
This method opens the control panel for the ASIO driver using the ASIO driver VTable.
- Exceptions
-
Exception | Throws an exception if there is an error while opening the control panel. |
◆ CreateBuffers()
void NAudio.Wave.Asio.AsioDriver.CreateBuffers |
( |
IntPtr | bufferInfos, |
|
|
int | numChannels, |
|
|
int | bufferSize, |
|
|
ref AsioCallbacks | callbacks ) |
|
inline |
Creates buffers for audio input and output.
- Parameters
-
bufferInfos | Pointer to buffer information. |
numChannels | The number of audio channels. |
bufferSize | The size of the buffer. |
callbacks | Reference to the AsioCallbacks structure. |
- Exceptions
-
AsioException | Thrown if there is an error creating the buffers. |
This method creates buffers for audio input and output using the provided buffer information, number of channels, buffer size, and AsioCallbacks structure. It allocates memory for the callbacks, marshals the structure, and handles any exceptions that may occur during the buffer creation process.
◆ DisposeBuffers()
AsioError NAudio.Wave.Asio.AsioDriver.DisposeBuffers |
( |
| ) |
|
|
inline |
Disposes the ASIO buffers and frees the allocated memory.
- Returns
- The result of disposing the ASIO buffers.
This method disposes the ASIO buffers and frees the allocated memory.
◆ Future()
void NAudio.Wave.Asio.AsioDriver.Future |
( |
int | selector, |
|
|
IntPtr | opt ) |
|
inline |
Calls the ASIO driver's future function with the specified selector and options.
- Parameters
-
selector | The selector for the future function. |
opt | The options to be passed to the future function. |
- Exceptions
-
AsioException | Thrown if there is an error calling the ASIO driver's future function. |
◆ GetAsioDriverByGuid()
static AsioDriver NAudio.Wave.Asio.AsioDriver.GetAsioDriverByGuid |
( |
Guid | guid | ) |
|
|
inlinestatic |
Retrieves an ASIO driver based on the specified GUID.
- Parameters
-
guid | The GUID of the ASIO driver to retrieve. |
- Returns
- An instance of the AsioDriver class initialized with the specified GUID.
◆ GetAsioDriverByName()
static AsioDriver NAudio.Wave.Asio.AsioDriver.GetAsioDriverByName |
( |
String | name | ) |
|
|
inlinestatic |
Retrieves the ASIO driver with the specified name.
- Parameters
-
name | The name of the ASIO driver to retrieve. |
- Returns
- The ASIO driver with the specified name .
- Exceptions
-
ArgumentException | Thrown when the specified name does not exist in the registry. |
◆ GetAsioDriverNames()
static string[] NAudio.Wave.Asio.AsioDriver.GetAsioDriverNames |
( |
| ) |
|
|
inlinestatic |
Retrieves the names of ASIO drivers installed on the system.
- Returns
- An array of strings containing the names of the ASIO drivers installed on the system.
This method retrieves the names of ASIO drivers by accessing the registry key "SOFTWARE\\ASIO" under the Local Machine hive. It initializes an empty string array and populates it with the names of the subkeys under the "SOFTWARE\\ASIO" registry key. If the registry key does not exist or is inaccessible, an empty array is returned.
◆ GetBufferSize()
void NAudio.Wave.Asio.AsioDriver.GetBufferSize |
( |
out int | minSize, |
|
|
out int | maxSize, |
|
|
out int | preferredSize, |
|
|
out int | granularity ) |
|
inline |
Retrieves the buffer size information from the ASIO driver.
- Parameters
-
minSize | The minimum buffer size supported by the ASIO driver. |
maxSize | The maximum buffer size supported by the ASIO driver. |
preferredSize | The preferred buffer size suggested by the ASIO driver. |
granularity | The granularity of buffer size adjustments supported by the ASIO driver. |
This method retrieves the buffer size information from the ASIO driver using the ASIO driver's pAsioComObject . It handles exceptions using the HandleException method and passes the retrieved buffer size information to the out parameters.
- Exceptions
-
Exception | Throws an exception if there is an error while retrieving the buffer size information from the ASIO driver. |
◆ GetChannelInfo()
AsioChannelInfo NAudio.Wave.Asio.AsioDriver.GetChannelInfo |
( |
int | channelNumber, |
|
|
bool | trueForInputInfo ) |
|
inline |
Retrieves the information about the specified channel.
- Parameters
-
channelNumber | The number of the channel for which information is to be retrieved. |
trueForInputInfo | A boolean value indicating whether to retrieve input information (true) or output information (false). |
- Returns
- The AsioChannelInfo object containing the information about the specified channel.
- Exceptions
-
AsioException | Thrown if there is an error while retrieving the channel information. |
◆ GetChannels()
void NAudio.Wave.Asio.AsioDriver.GetChannels |
( |
out int | numInputChannels, |
|
|
out int | numOutputChannels ) |
|
inline |
Retrieves the number of input and output channels available.
- Parameters
-
numInputChannels | The number of input channels available. |
numOutputChannels | The number of output channels available. |
- Exceptions
-
Exception | Thrown if there is an error retrieving the channels. |
◆ GetClockSources()
void NAudio.Wave.Asio.AsioDriver.GetClockSources |
( |
out long | clocks, |
|
|
int | numSources ) |
|
inline |
Retrieves the clock sources and outputs the result in the clocks parameter.
- Parameters
-
clocks | The output parameter that will contain the retrieved clock sources. |
numSources | The number of clock sources to retrieve. |
This method retrieves the clock sources from the ASIO driver and stores the result in the clocks parameter.
- Exceptions
-
Exception | Throws an exception if there is an error while retrieving the clock sources from the ASIO driver. |
◆ GetDriverName()
string NAudio.Wave.Asio.AsioDriver.GetDriverName |
( |
| ) |
|
|
inline |
Retrieves the name of the ASIO driver.
- Returns
- The name of the ASIO driver.
◆ GetDriverVersion()
int NAudio.Wave.Asio.AsioDriver.GetDriverVersion |
( |
| ) |
|
|
inline |
Gets the version of the driver.
- Returns
- The version of the driver.
◆ GetErrorMessage()
string NAudio.Wave.Asio.AsioDriver.GetErrorMessage |
( |
| ) |
|
|
inline |
Retrieves the error message from the ASIO driver and returns it as a string.
- Returns
- The error message retrieved from the ASIO driver.
◆ GetLatencies()
AsioError NAudio.Wave.Asio.AsioDriver.GetLatencies |
( |
out int | inputLatency, |
|
|
out int | outputLatency ) |
|
inline |
Retrieves the input and output latencies of the ASIO driver.
- Parameters
-
inputLatency | The variable to store the input latency. |
outputLatency | The variable to store the output latency. |
- Returns
- An AsioError representing the result of the operation.
This method retrieves the input and output latencies of the ASIO driver by calling the getLatencies
method of the ASIO driver's VTable. The input and output latencies are stored in the inputLatency and outputLatency variables, respectively.
◆ GetSamplePosition()
void NAudio.Wave.Asio.AsioDriver.GetSamplePosition |
( |
out long | samplePos, |
|
|
ref Asio64Bit | timeStamp ) |
|
inline |
Retrieves the current sample position and timestamp.
- Parameters
-
samplePos | The current sample position. |
timeStamp | The timestamp associated with the sample position. |
- Exceptions
-
Exception | Thrown if there is an error retrieving the sample position and timestamp. |
◆ GetSampleRate()
double NAudio.Wave.Asio.AsioDriver.GetSampleRate |
( |
| ) |
|
|
inline |
Retrieves the sample rate from the ASIO driver.
- Returns
- The sample rate retrieved from the ASIO driver.
This method retrieves the sample rate from the ASIO driver using the ASIO driver's getSampleRate function. It handles any exceptions that may occur during the retrieval process and returns the retrieved sample rate.
- Exceptions
-
Exception | Thrown if there is an error while retrieving the sample rate from the ASIO driver. |
◆ HandleException()
void NAudio.Wave.Asio.AsioDriver.HandleException |
( |
AsioError | error, |
|
|
string | methodName ) |
|
inlineprivate |
Handles the exception for the ASIO method.
- Parameters
-
error | The ASIO error code. |
methodName | The name of the ASIO method being called. |
- Exceptions
-
AsioException | Thrown when the ASIO error code is not ASE_OK or ASE_SUCCESS. The exception message contains the error code, method name, and error message. |
This method handles the exception for the ASIO method by checking the error code. If the error code is not ASE_OK or ASE_SUCCESS, it creates and throws an AsioException with the error code, method name, and error message.
◆ Init()
bool NAudio.Wave.Asio.AsioDriver.Init |
( |
IntPtr | sysHandle | ) |
|
|
inline |
Initializes the ASIO driver with the specified system handle.
- Parameters
-
sysHandle | A pointer to the system handle. |
- Returns
- True if the initialization is successful; otherwise, false.
This method initializes the ASIO driver using the provided system handle. It calls the 'init' method of the ASIO driver VTable and returns true if the return value is 1, indicating successful initialization.
◆ InitFromGuid()
void NAudio.Wave.Asio.AsioDriver.InitFromGuid |
( |
Guid | asioGuid | ) |
|
|
inlineprivate |
Initializes the ASIO driver from the given GUID and sets up the virtual table for method calls.
- Parameters
-
asioGuid | The GUID of the ASIO driver to be initialized. |
- Exceptions
-
COMException | Thrown when unable to instantiate ASIO. Check if STAThread is set. |
This method initializes the ASIO driver by querying the virtual table at index 3 and setting up the virtual table for method calls. It uses CoCreateInstance instead of built-in COM-Class instantiation, as the AsioDriver expects the ASIOGuid used for both COM Object and COM interface. The CoCreateInstance works only in STAThread mode. The method modifies the original ASIO Com Object in place by attaching internal delegates to call the methods on the COM Object.
◆ OutputReady()
AsioError NAudio.Wave.Asio.AsioDriver.OutputReady |
( |
| ) |
|
|
inline |
Checks if the output is ready and returns an AsioError.
- Returns
- An AsioError indicating the status of the output readiness.
◆ ReleaseComAsioDriver()
void NAudio.Wave.Asio.AsioDriver.ReleaseComAsioDriver |
( |
| ) |
|
|
inline |
Releases the COM object associated with the ASIO driver.
This method releases the COM object pAsioComObject associated with the ASIO driver.
◆ SetClockSource()
void NAudio.Wave.Asio.AsioDriver.SetClockSource |
( |
int | reference | ) |
|
|
inline |
Sets the clock source for the ASIO driver.
- Parameters
-
reference | The reference value for setting the clock source. |
- Exceptions
-
Exception | Thrown when an error occurs while setting the clock source. |
This method sets the clock source for the ASIO driver using the provided reference value.
◆ SetSampleRate()
void NAudio.Wave.Asio.AsioDriver.SetSampleRate |
( |
double | sampleRate | ) |
|
|
inline |
Sets the sample rate for the ASIO driver.
- Parameters
-
sampleRate | The sample rate to be set. |
This method sets the sample rate for the ASIO driver using the provided sampleRate .
- Exceptions
-
AsioException | Thrown if there is an error setting the sample rate. |
◆ Start()
void NAudio.Wave.Asio.AsioDriver.Start |
( |
| ) |
|
|
inline |
Starts the ASIO driver.
This method calls the start function of the ASIO driver's VTable to initiate the driver.
- Exceptions
-
Exception | Throws an exception if there is an error while starting the ASIO driver. |
◆ Stop()
AsioError NAudio.Wave.Asio.AsioDriver.Stop |
( |
| ) |
|
|
inline |
Stops the ASIO driver and returns any error that occurred during the operation.
- Returns
- An AsioError object representing any error that occurred during the stop operation.
◆ asioDriverVTable
◆ pAsioComObject
IntPtr NAudio.Wave.Asio.AsioDriver.pAsioComObject |
|
private |
◆ pinnedcallbacks
IntPtr NAudio.Wave.Asio.AsioDriver.pinnedcallbacks |
|
private |
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Asio/ASIODriver.cs