BASS.NET API for the Un4seen BASS Audio LibraryBassAsioBASS_ASIO_Init Method BASS.NET API for the Un4seen BASS Audio Library
Initializes an Asio device/driver.

Namespace: Un4seen.BassAsio
Assembly: Bass.Net (in Bass.Net.dll) Version:

public static bool BASS_ASIO_Init(
	int device,
	BASSASIOInit flags


Type: SystemInt32
The device to use... 0 = first device. BASS_ASIO_GetDeviceInfo(Int32, BASS_ASIO_DEVICEINFO) can be used to get the total number of devices.
Type: Un4seen.BassAsioBASSASIOInit
Any combination of these flags (see BASSASIOInit):
BASS_ASIO_THREADHost the driver in a dedicated thread, else the current thread.
BASS_ASIO_JOINORDERPlace joined channels in the order in which BASS_ASIO_ChannelJoin(Boolean, Int32, Int32) was called to join them, else place them in numerically ascending order.
BASS_ASIO_VOLRAMPRamp volume changes (of output channels).

Return Value

Type: Boolean
If the device was successfully initialized, is returned, else is returned. Use BASS_ASIO_ErrorGetCode to get the error code.

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 BASS_ASIO_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. BASS_ASIO_SetDevice(Int32) is used to switch the current device. When successful, BASS_ASIO_Init automatically sets the current thread's device to the one that was just initialized.

ERROR CODEDescription
BASS_ERROR_DEVICEThe device number specified is invalid.
BASS_ERROR_ALREADYA device has already been initialized. You must call BASS_ASIO_Free before you can initialize again.
BASS_ERROR_DRIVERThe driver couldn't be initialized.

See Also