Initializes an ASIO device/driver.

    int device,
    DWORD flags


deviceThe device to use... 0 = first device, -1 = first available device. BASS_ASIO_GetDeviceInfo can be used to enumerate the available devices.
flagsAny combination of these flags.
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 was called to join them, else place them in numerically ascending order.

Return value

If the device was successfully initialized, TRUE is returned, else FALSE is returned. Use BASS_ASIO_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_DEVICEThe device number specified is invalid.
BASS_ERROR_ALREADYThe device has already been initialized. You must call BASS_ASIO_Free before you can initialize it again.
BASS_ERROR_DRIVERThe driver could not be initialized.


This function must be successfully called before any input or output can be performed. When the first available device is initialized, BASS_ASIO_GetDevice can be used afterwards to find out which device that is.

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

See also