Class BassAsio
BassAsio makes it simple to use ASIO hardware, drivers, and can be used with or without BASS.
Namespace: System.Dynamic.ExpandoObject
Assembly: ManagedBass.Asio.dll
Syntax
public static class BassAsio : object
Properties
CPUUsage
Retrieves the current CPU usage of BASSASIO.
Declaration
public static double CPUUsage { get; }
Property Value
Double
The BASSASIO CPU usage as a percentage of total CPU time. |
Remarks
This function includes the time taken by the AsioProcedure callback functions.
CurrentDevice
Gets or Sets the Asio device to use for subsequent calls in the current thread... 0 = first device.
Declaration
public static int CurrentDevice { get; set; }
Property Value
Int32
|
Remarks
Throws BassException on Error while setting value.
As in BASS, simultaneously using multiple devices is supported in the BASSASIO API via a context switching system - instead of there being an extra "device" parameter in the function calls, the device to be used needs to be set via this function prior to calling the function. The device setting is local to the current thread, so calling functions with different devices simultaneously in multiple threads is not a problem.
The device context setting is used by any function that may result in a Init error (except this function), which is the majority of them. When one if those functions is called, it will check the current thread's device setting, and if no device is selected (or the selected device is not initialized), BassAsio will automatically select the lowest device that is initialized. This means that when using a single device, there is no need to use this function - BassAsio will automatically use the device that's initialized. Even if you free the device, and initialize another, BassAsio will automatically switch to the one that is initialized.
DeviceCount
Returns the total number of available Asio devices.
Declaration
public static int DeviceCount { get; }
Property Value
Int32
Number of ASIO devices available. |
Remarks
Uses GetDeviceInfo(Int32, out AsioDeviceInfo) internally.
Info
Retrieves information on the Asio device being used.
Declaration
public static AsioInfo Info { get; }
Property Value
AsioInfo
An instance of the AsioInfo structure. Throws BassException on Error. |
Remarks
As in BASS, simultaneously using multiple devices is supported in the BASSASIO API via a context switching system - instead of there being an extra "device" parameter in the function calls, the device to be used needs to be set via CurrentDevice prior to calling the function. The device setting is local to the current thread, so calling functions with different devices simultaneously in multiple threads is not a problem.
IsStarted
Checks, if the current Asio device has been started.
Declaration
public static bool IsStarted { get; }
Property Value
Boolean
Returns true, if the device has been started, else false is returned. Use LastError to get the error code. |
LastError
Retrieves the error code for the most recent BassAsio function call in the current thread.
Declaration
public static Errors LastError { get; }
Property Value
Errors
If no error occured during the last BassAsio function call then OK is returned, else one of the Errors values is returned. See the function description for an explanation of what the error code means. |
Remarks
Error codes are stored for each thread. So if you happen to call 2 or more BassAsio functions at the same time, they will not interfere with eachother's error codes.
Rate
Gets or Sets the current Asio device's sample rate.
Declaration
public static double Rate { get; set; }
Property Value
Double
|
Remarks
Throws BassException on Error while setting value.
When it's not possible to set the device to the rate wanted, this can be used to overcome that.Unicode
Gets or Sets the character set used in device information text: if false, ANSI is used (default), else UTF-16 is used.
Declaration
public static bool Unicode { get; set; }
Property Value
Boolean
|
Remarks
Throws BassException on Error setting value.
This function determines the character set that is used in the AsioDeviceInfo structure and in AddDevice(Guid, String, String) function calls. It does not affect ASIO channel names in the AsioChannelInfo and AsioInfo structure.The character set choice is finalised in the first GetDeviceInfo(Int32, out AsioDeviceInfo), AddDevice(Guid, String, String) or Init(Int32, AsioInitFlags) call, and it cannot be changed after that.
Version
Gets the version of BassAsio that is Loaded.
Declaration
public static Version Version { get; }
Property Value
Version
|
Methods
AddDevice(Guid, String, String)
Adds a driver to the device list.
Declaration
public static int AddDevice(Guid ClsID, string Driver, string Name)
Parameters
Guid
ClsID
The driver's class ID. |
String
Driver
The filename of the driver. |
String
Name
An optional description of the driver. |
Returns
Int32
If successful, the new device number is returned (which might be used in a subsequent Init(Int32, AsioInitFlags) call), else -1 is returned. Use LastError to get the error code. |
Remarks
A list of installed ASIO drivers is kept in the Windows registry, which is where BassAsio gets its device list from, but it is also possible to add unregistered drivers (eg. private drivers) to the list via this function. If successful, the returned device number can be used in a Init(Int32, AsioInitFlags) call to use the driver.
The Driver
and
ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr)
Enable/disable processing of an Asio channel.
Declaration
public static bool ChannelEnable(bool Input, int Channel, AsioProcedure Procedure, IntPtr User = null)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
AsioProcedure
Procedure
The user defined function to process the channel... null = disable the channel. |
IntPtr
User
User instance data to pass to the callback function. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
All ASIO channels are mono. Stereo (and above) channels can be formed by joining multiple channels together using ChannelJoin(Boolean, Int32, Int32).
Use Start(Int32, Int32) to begin processing the enabled channels.
You might also use this function on an already enabled ASIO channel if you just want to change the AsioProcedure which should be used. However changing the callback procedure to null would disable the channel - which is only possible, if the ASIO device is stopped.
ChannelEnableMirror(Int32, Boolean, Int32)
Enables an output channel, and makes it mirror another channel.
Declaration
public static bool ChannelEnableMirror(int Channel, bool Input2, int Channel2)
Parameters
Int32
Channel
The output channel number... 0 = first. |
Boolean
Input2
Mirroring an input channel? false = an output channel. |
Int32
Channel2
The channel to mirror. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
This function allows an input or output channel to be duplicated in other output channel. This can be achieved using normal AsioProcedure processing, but it's more efficient to let BassAsio simply copy the data from one channel to another.
Mirror channels can't be joined together to form multi-channel mirrors. Instead, to mirror multiple channels, an individual mirror should be setup for each of them.
After Start(Int32, Int32) has been called to begin processing, it's not possible to setup new mirror channels, but it is still possible to change the channel that a mirror is mirroring.
When mirroring an output channel that hasn't been enabled, the mirror channel will just produce silence. When mirroring an input channel that hasn't already been enabled, the channel is automatically enabled for processing when Start(Int32, Int32) is called, so that it can be mirrored. If the mirror is switched to a disabled input channel once processing has begun, then it will produce silence.
A mirror channel can be made to have a different volume level to the channel that it's mirroring, using ChannelSetVolume(Boolean, Int32, Double). The volume setting is cumulative. For example, if the mirror channel has a volume setting of 0.5 and the mirrored channel has a volume setting of 0.4, the effective volume of the mirror channel will be 0.2 (0.5 x 0.4).
ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr) can be used to disable a mirror channel.
ChannelGetFormat(Boolean, Int32)
Retrieves a channel's sample format.
Declaration
public static AsioSampleFormat ChannelGetFormat(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Returns
AsioSampleFormat
If an error occurs, -1 (Unknown) is returned, use LastError to get the error code. |
ChannelGetInfo(Boolean, Int32)
Retrieves information on an Asio channel.
Declaration
public static AsioChannelInfo ChannelGetInfo(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Returns
AsioChannelInfo
An instance of the AsioChannelInfo structure is returned. Throws BassException on Error. |
ChannelGetInfo(Boolean, Int32, out AsioChannelInfo)
Retrieves information on an Asio channel.
Declaration
public static bool ChannelGetInfo(bool Input, int Channel, out AsioChannelInfo Info)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
AsioChannelInfo
Info
An instance of the AsioChannelInfo structure to store the information at. |
Returns
Boolean
If successful, true is returned, else false is returned. Use LastError to get the error code. |
ChannelGetLevel(Boolean, Int32)
Retrieves the level (peak amplitude) of a channel.
Declaration
public static double ChannelGetLevel(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Returns
Double
If an error occurs, -1 is returned, use LastError to get the error code. If successful, the level of the channel is returned, ranging from 0 (silent) to 1 (max). If the channel's native sample format is floating-point, it is actually possible for the level to go above 1. |
Remarks
This function measures the level of a single channel, and is not affected by any other channels that are joined with it.
Volume settings made via ChannelSetVolume(Boolean, Int32, Double) affect the level reading of output channels, but not input channels.
When an input channel is paused, it is still possible to get its level. Paused output channels will have a level of 0.
Level retrieval is not supported when the sample format is DSD.
ChannelGetRate(Boolean, Int32)
Retrieves a channel's sample rate.
Declaration
public static double ChannelGetRate(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Returns
Double
If succesful, the channel's sample rate is returned (0 = device rate), else -1 is returned. Use LastError to get the error code. |
ChannelGetVolume(Boolean, Int32)
Retrieves a channel's volume setting.
Declaration
public static double ChannelGetVolume(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first, -1 = master. |
Returns
Double
If successful, the channel's volume setting is returned, else -1 is returned. Use LastError to get the error code. |
Remarks
To set a channel volume use ChannelSetVolume(Boolean, Int32, Double).
ChannelIsActive(Boolean, Int32)
Checks if a channel is enabled for processing.
Declaration
public static AsioChannelActive ChannelIsActive(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Returns
AsioChannelActive
One AsioChannelActive value is returned. |
Remarks
When a channel is joined to another, the status of the other channel is returned, as that is what determines whether the channel is enabled for processing - whether it's been enabled itself is of no consequence while it is joined to another. For example, if channel B is joined to channel A, and channel A is not enabled, then neither is channel B.
ChannelJoin(Boolean, Int32, Int32)
Join a channel to another.
Declaration
public static bool ChannelJoin(bool Input, int Channel, int Channel2)
Parameters
Boolean
Input
Dealing with input channels? false = output channels. |
Int32
Channel
The input/output channel number... 0 = first. |
Int32
Channel2
The channel to join it to... -1 = remove current join. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
All ASIO channels are mono. By joining them, stereo (and above) channels can be formed, making it simpler to process stereo (and above) sample data.
By default, channels can only be joined to preceding channels. For example, channel 1 can be joined to channel 0, but not vice versa. The JoinOrder flag can be used in the Init(Int32, AsioInitFlags) call to remove that restriction. When joining a group of channels, there should be one channel enabled via ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr) with the rest joined to it - do not join a channel to a channel that is itself joined to another channel. Mirror channels, setup using ChannelEnableMirror(Int32, Boolean, Int32), cannot be joined with.
If a channel has two or more other channels joined to it, then the joined channels will default to being in numerically ascending order in the AsioProcedure callback function's sample data unless the JoinOrder flag was used in the Init(Int32, AsioInitFlags) call, in which case they will be in the order in which they were joined via this function. In the latter case, if this function is called on an already joined channel, the channel will be moved to the end of the joined group.
While a channel is joined to another, it automatically takes on the attributes of the other channel - the other channel's settings determine the sample format, the sample rate and whether it is enabled. The volume setting remains individual though, allowing balance control over the joined channels.
ChannelPause(Boolean, Int32)
Suspends processing of a channel.
Declaration
public static bool ChannelPause(bool Input, int Channel)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
Channels can only be disabled when the device is stopped. When you want to stop processing only some of the enabled channels, there are few ways that could be done. You could quickly stop the device, disable the unwanted channels, and restart the device. In the case of output channels, you could fill the channels' buffers with silence (0s) in the AsioProcedure. Or you could pause the channels, using this function. The less channels BassAsio has to process, the less CPU it'll use, so stopping and restarting the device would be the most efficient, but that could cause a slight break in the sound of the other channels. Filling the buffers with silence is the least efficient, as BassAsio will still process the data as if it was "normal", but it does mean that other channels are unaffected. Pausing is a compromise between the two - the channels will still be enabled, but BassAsio will bypass any additional processing (resampling/etc) that may normally be required.
Use ChannelReset(Boolean, Int32, AsioChannelResetFlags) to resume processing of a paused channel.
ChannelReset(Boolean, Int32, AsioChannelResetFlags)
Resets the attributes of a channel (or all channels).
Declaration
public static bool ChannelReset(bool Input, int Channel, AsioChannelResetFlags Flags)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first, -1 = all channels. |
AsioChannelResetFlags
Flags
The attributes to reset. A combination of AsioChannelResetFlags. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
When resetting all channels (channel = -1), the resetting only applies to all channels of the specified type, ie. input or output, not both.
ChannelSetFormat(Boolean, Int32, AsioSampleFormat)
Sets a channel's sample format.
Declaration
public static bool ChannelSetFormat(bool Input, int Channel, AsioSampleFormat Format)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
AsioSampleFormat
Format
The sample format. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
The sample format can vary between ASIO devices/drivers, which could mean a lot of extra/duplicate code being required. To avoid that extra work, BassAsio can automatically convert the sample data, whenever necessary, to/from a format of your choice. The native format of a channel can be retrieved via ChannelGetInfo(Boolean, Int32, out AsioChannelInfo).
The PCM format options are only available when the device's format is PCM, and the DSD format options are only available when the device's format is DSD. If a device supports both, it can be switched between DSD and PCM via SetDSD(Boolean).
For performance reasons, it's best not to use 24-bit sample data whenever possible, as 24-bit data requires a bit more processing than the other formats.
ChannelSetRate(Boolean, Int32, Double)
Sets a channel's sample rate.
Declaration
public static bool ChannelSetRate(bool Input, int Channel, double Rate)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first. |
Double
Rate
The sample rate... 0 = device rate. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
For optimal quality and performance, it is best to set the device to the sample rate you want via Rate, but that's not always possible. Which is where this function and resampling comes into play. 16 point sinc interpolation is used, giving a good blend of sound quality and performance. It is also SSE2 and 3DNow optimized for an extra boost with supporting CPUs.
When a channel's sample rate is the same as the device rate, resampling is bypassed, so there's no unnecessary performance hit.
Resampling is not supported when the sample format is DSD.
Un4seen.Bass.BASSError | Description |
---|---|
BASS_ERROR_INIT | |
BASS_ERROR_ILLPARAM | |
BASS_ERROR_FORMAT |
ChannelSetVolume(Boolean, Int32, Double)
Sets a channel's volume.
Declaration
public static bool ChannelSetVolume(bool Input, int Channel, double Volume)
Parameters
Boolean
Input
Dealing with an input channel? false = an output channel. |
Int32
Channel
The input/output channel number... 0 = first, -1 = master. |
Double
Volume
The volume level... 0 (silent)...1.0 (normal). Above 1.0 amplifies the sound. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
Apart from the master volume (channel = -1), this function applies a volume level to a single channel, and does not affect any other channels that are joined with it. This allows balance control over joined channels, by setting the individual volume levels accordingly. The final level of a channel is = master volume * channel volume.
The volume "curve" is linear, but logarithmic levels can be easily used. See the example below.
ASIO drivers do not provide volume control themselves, so the volume adjustments are applied to the sample data by BassAsio. This also means that changes do not persist across sessions, and the channel volume levels will always start at 1.0.
When the channel's sample format is DSD, a 0 volume setting will mute the channel and anything else will be treated as 1.0 (normal).
CheckRate(Double)
Checks if a sample rate is supported by the device.
Declaration
public static bool CheckRate(double Rate)
Parameters
Double
Rate
The sample rate to check. |
Returns
Boolean
If the sample rate is supported, then true is returned, else false is returned. Use LastError to get the error code. |
ControlPanel()
Displays the current Asio driver's control panel.
Declaration
public static bool ControlPanel()
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Free()
Releases the Asio device/driver.
Declaration
public static bool Free()
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
Make sure to free each Asio device you have initialized with Init(Int32, AsioInitFlags), CurrentDevice is used to switch the current device.
Future(AsioFuture, IntPtr)
Provides access to the driver's 'future' function.
Declaration
public static bool Future(AsioFuture Selector, IntPtr Param)
Parameters
AsioFuture
Selector
Operation code. |
IntPtr
Param
Pointer to the operation's parameters, if applicable. |
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
This method is a general purpose extension method serving various purposes.
GetDeviceInfo(Int32)
Retrieves information on an Asio device.
Declaration
public static AsioDeviceInfo GetDeviceInfo(int Device)
Parameters
Int32
Device
The device to get the information of... 0 = first. |
Returns
AsioDeviceInfo
An instance of the AsioDeviceInfo structure is returned. Throws BassException on Error. |
Remarks
This function can be used to enumerate the available Asio devices for a setup dialog.
GetDeviceInfo(Int32, out AsioDeviceInfo)
Retrieves information on an Asio device.
Declaration
public static bool GetDeviceInfo(int Device, out AsioDeviceInfo Info)
Parameters
Int32
Device
The device to get the information of... 0 = first. |
AsioDeviceInfo
Info
An instance of the AsioDeviceInfo structure to store the information at. |
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
This function can be used to enumerate the available Asio devices for a setup dialog.
GetInfo(out AsioInfo)
Retrieves information on the Asio device being used.
Declaration
public static bool GetInfo(out AsioInfo Info)
Parameters
AsioInfo
Info
An instance of the BassInfo structure to store the information at. |
Returns
Boolean
If successful, true is returned, else false is returned. Use LastError to get the error code. |
Remarks
As in BASS, simultaneously using multiple devices is supported in the BASSASIO API via a context switching system - instead of there being an extra "device" parameter in the function calls, the device to be used needs to be set via CurrentDevice prior to calling the function. The device setting is local to the current thread, so calling functions with different devices simultaneously in multiple threads is not a problem.
GetLatency(Boolean)
Retrieves the latency of input or output channels of the current Asio device
Declaration
public static int GetLatency(bool Input)
Parameters
Boolean
Input
Get the input latency? false = the output latency. |
Returns
Int32
If successful, the latency in samples is returned, else -1 is returned. Use LastError to get the error code. |
Remarks
The latency is the delay between the sound being recorded and reaching an AsioProcedure, in the case of input channels. And the delay between the sample data being fed to an AsioProcedure and actually being heard, in the case of output channels. The latency is dependant on the buffer size, as specified in the Start(Int32, Int32) call. So the latency should be checked after making that call, not before.
The latency time can by calculated be dividing the sample latency by the device sample rate. When a channel is being resampled, the sample latency will change, but the effective latency time remains constant.
Init(Int32, AsioInitFlags)
Initializes an Asio device/driver.
Declaration
public static bool Init(int Device, AsioInitFlags Flags)
Parameters
Int32
Device
The device to use... 0 = first device. GetDeviceInfo(Int32, out AsioDeviceInfo) can be used to get the total number of devices. |
AsioInitFlags
Flags
Any combination of AsioInitFlags. |
Returns
Boolean
If the device was successfully initialized, true is returned, else false is returned. Use LastError to get the error code. |
Remarks
This function must be successfully called before any input or output can be performed.
The ASIO driver is accessed via a COM object using the single-threaded apartment model, which means that requests to the driver go through the thread that initialized it, so the thread needs to exist as long as the driver remains initialized. The thread should also have a message queue. If device initializing and releasing from multiple threads is required, or the application does not have a message queue (eg. a console application), then the Thread flag can be used to have BassAsio create a dedicated thread to host the ASIO driver.
Simultaneously using multiple devices is supported in the BassAsio API via a context switching system - instead of there being an extra "device" parameter in the function calls, the device to be used is set prior to calling the functions. CurrentDevice is used to switch the current device. When successful, the current thread's device is set to the one that was just initialized.
Monitor(Int32, Int32, Int32, Int32, Int32)
Set the direct input monitoring state.
Declaration
public static bool Monitor(int Input, int Output, int Gain, int State, int Pan)
Parameters
Int32
Input
The input channel to set the monitoring state of... -1 = all. |
Int32
Output
The suggested output channel for the monitoring. |
Int32
Gain
Suggested Gain, ranging from 0 to 0x7fffffff (-inf to +12 dB), 0x20000000 equals 0 dB. |
Int32
State
Monitoring state... 0 = off, 1 = on. Other settings may be possible depending on the drivers, e.g.: 0 = input monitoring off. 1 = input monitoring on. 2 = playback monitoring off. 3 = playback monitoring on. |
Int32
Pan
Suggested Pan, ranging from 0 = left to 0x7fffffff = right (centre should be 0x40000000). |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
If the hardware does not support patching and mixing a straight 1 to 1 routing is suggested. The driver should ignore all the information of ASIOMonitor it cannot deal with, usually these might be either or all of output, gain, pan.
Output is the base channel of a stereo channel pair, i.e. output is always an even channel (0,2,4...). If an odd input channel should be monitored and no panning or output routing can be applied, the driver has to use the next higher output (imply a hard right pan). Note that the output, gain and pan settings are just suggestions, and may be ignored by the device/driver.
Some cards/drivers might also support direct output monitoring, in such case use the Input
parameter to denote the output channel to monitor and specify an appropriate State
value.
ADM has originally been based on a mono in - stereo out scheme. Meaning if you need to monitor a stereo input channel pair you need to call this twice, both using the same output value, but using an odd and an even input value. In such case set the odd input to pan hard left and the even input to pan hard right.
Also note, that if you have channels in-between not activated in ASIO these will not counted. So if for example channels 3 and 4 are inactive, ADM input 3 is related to the physical input channel 5!
SetDSD(Boolean)
Sets the device's sample format to DSD or PCM.
Declaration
public static bool SetDSD(bool DSD = true)
Parameters
Boolean
DSD
Set the sample format to DSD? |
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
When a device is switched between PCM and DSD formats, the ASIO channels' format will change accordingly, as reported by ChannelGetInfo(Boolean, Int32, out AsioChannelInfo). Any ChannelSetFormat(Boolean, Int32, AsioSampleFormat) and ChannelSetRate(Boolean, Int32, Double) settings that have been applied will be reset to defaults. Other channel settings are unchanged.
SetNotify(AsioNotifyProcedure, IntPtr)
Sets a notification callback on the ASIO driver.
Declaration
public static bool SetNotify(AsioNotifyProcedure Procedure, IntPtr User = null)
Parameters
AsioNotifyProcedure
Procedure
User defined notification function... null = disable notifications. |
IntPtr
User
User instance data to pass to the callback function. |
Returns
Boolean
If succesful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
A previously set notification callback can be changed (or removed) at any time, by calling this function again.
Start(Int32, Int32)
Starts the current Asio device.
Declaration
public static bool Start(int BufferLength = 0, int Threads = 0)
Parameters
Int32
BufferLength
Buffer length in samples... 0 = use current length. |
Int32
Threads
The number of processing threads to use... 0 = use current number. |
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
Before starting the device, channels must be enabled using ChannelEnable(Boolean, Int32, AsioProcedure, IntPtr). Once started, channels can't be enabled or disabled until the device is stopped, using Stop().
The default number of processing threads is 1, which means that the AsioProcedure functions of the enabled channels get called in series (starting with the lowest input channel). Multiple channels can be processed in parallel if multiple threads are created for that purpose via the threads parameter. The number of threads is automatically capped at the number of enabled channels with an AsioProcedure function, which is sufficient to have them all processed simultaneously.
Stop()
Stops the current Asio device.
Declaration
public static bool Stop()
Returns
Boolean
If successful, then true is returned, else false is returned. Use LastError to get the error code. |
Remarks
As in BASS, simultaneously using multiple devices is supported in the BASSASIO API via a context switching system - instead of there being an extra "device" parameter in the function calls, the device to be used needs to be set via CurrentDevice prior to calling the function. The device setting is local to the current thread, so calling functions with different devices simultaneously in multiple threads is not a problem.