BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_GetDeviceInfo Method (Int32)BASS.NET API for the Un4seen BASS Audio Library
Retrieves information on an output device.

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

public static BASS_DEVICEINFO BASS_GetDeviceInfo(
	int device
)

Parameters

device
Type: SystemInt32
The device to get the information of... 0 = first.

Return Value

Type: BASS_DEVICEINFO
If successful, then an instance of the BASS_DEVICEINFO class is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

This function can be used to enumerate the available devices for a setup dialog. Device 0 is always the "no sound" device, so if you should start at device 1 if you only want to list real devices.

ERROR CODEDescription
BASS_ERROR_DEVICEThe device number specified is invalid.

Platform-specific

On Linux, a "Default" device is hardcoded to device number 1, which uses the default output set in the ALSA config, and the real devices start at number 2.

Examples

Find the system default device:
VB
Dim defDevice As Integer = -1
Dim n As Integer = 0
Dim info As New BASS_DEVICEINFO()
While Not (info Is Nothing)
  info = Bass.BASS_GetDeviceDescription(n)
  If Not (info Is Nothing) And info.IsDefault Then
    defDevice = n
    Exit While
  End If
  n += 1
End While
int defDevice = -1;
BASS_DEVICEINFO info;
for (int n = 0; (info = Bass.BASS_GetDeviceInfo(n)) != null; n++)
{
  if (info.IsDefault)
  {
    defDevice = n;
    break;
  }
}
Or use the BASS_GetDeviceInfos method for more convenience.
See Also

Reference