BASS_GetDeviceInfo


Retrieves information on an output device.

BOOL BASS_GetDeviceInfo(
    DWORD device,
    BASS_DEVICEINFO *info
);

Parameters

deviceThe device to get the information of... 0 = first.
infoPointer to a structure to receive the information.

Return value

If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_DEVICEdevice is invalid.

Remarks

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

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. That is also the case on Windows when the BASS_CONFIG_DEV_DEFAULT option is enabled.

On OSX, the BASS_DEVICES_AIRPLAY flag can be used in the device paramater to enumerate Airplay receivers instead of soundcards. A shared buffer is used for the Airplay receiver name information, which gets overwritten each time Airplay receiver information is requested, so it should be copied if needed. The BASS_CONFIG_AIRPLAY config option can be used to change which of the receiver(s) are used.

Example

Get the total number of devices currently present.
int a, count=0;
BASS_DEVICEINFO info;
for (a=0; BASS_GetDeviceInfo(a, &info); a++)
    if (info.flags&BASS_DEVICE_ENABLED) // device is enabled
        count++; // count it

List all Airplay receivers available on OSX.

int a;
BASS_DEVICEINFO info;
for (a=0; BASS_GetDeviceInfo(a|BASS_DEVICES_AIRPLAY, &info); a++)
    printf("%d: name=[%s] flags=%x\n", a, di.name, di.flags);

See also

BASS_GetInfo, BASS_Init, BASS_DEVICEINFO structure