BASS.NET API for the Un4seen BASS Audio LibraryBassAsioBASS_ASIO_SetDevice Method BASS.NET API for the Un4seen BASS Audio Library
Sets the device to use for subsequent calls in the current thread.

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

public static bool BASS_ASIO_SetDevice(
	int device


Type: SystemInt32
The device to use... 0 = first device.

Return Value

Type: Boolean
If successful, then is returned, else is returned. Use BASS_ASIO_ErrorGetCode to get the error code.

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 is set prior to calling the functions. 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 BASS_ERROR_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.

ERROR CODEDescription
BASS_ERROR_DEVICEThe device number specified is invalid.
BASS_ERROR_INITThe device has not been initialized.


Get the sample rate of device 2:
' select device 2
' get the sample rate
Dim rate As Double = BassAsio.BASS_ASIO_GetRate()
// select device 2
// get the sample rate
double rate = BassAsio.BASS_ASIO_GetRate();
See Also