Initializes an ASIO device/driver.
BOOL BASS_ASIO_Init( int device, DWORD flags );
device | The device to use... 0 = first device, -1 = first available device. BASS_ASIO_GetDeviceInfo can be used to enumerate the available devices. | ||||
flags | Any combination of these flags.
|
BASS_ERROR_DEVICE | The device number specified is invalid. |
BASS_ERROR_ALREADY | The device has already been initialized. You must call BASS_ASIO_Free before you can initialize it again. |
BASS_ERROR_DRIVER | The driver could not be initialized. |
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.