BASS_WASAPI_CheckFormat

Checks if a particular sample format is supported by a device.

DWORD BASS_WASAPI_CheckFormat(
    int device,
    DWORD freq,
    DWORD chans,
    DWORD flags
);

Parameters

deviceThe device to use... -1 = default output device, -2 = default input device, -3 = default loopback input device. BASS_WASAPI_GetDeviceInfo can be used to enumerate the available devices.
freqThe sample rate.
chansThe number of channels... 1 = mono, 2 = stereo, etc.
flagsAny combination of these flags.
BASS_WASAPI_EXCLUSIVECheck the device in exclusive mode, else shared mode. The HIWORD - use MAKELONG(flags,format) - can be used to limit the sample formats that are checked in exclusive mode. The default is to check 32-bit floating-point, 32-bit integer, 24-bit integer, 16-bit integer, 8-bit integer, in that order. A BASS_WASAPI_FORMAT value (see BASS_WASAPI_INFO) can be used to bypass the formats that precede it in that list.

Return value

If the sample format is supported, the maximum supported resolution (a BASS_WASAPI_FORMAT value) is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_WASAPIWASAPI is not available.
BASS_ERROR_DEVICEdevice is invalid.
BASS_ERROR_NOTAVAILExclusive mode is unavailable on the device.
BASS_ERROR_DRIVERThe driver could not be initialized.
BASS_ERROR_FORMATThe specified format is not supported by the device.

Remarks

Shared and exclusive modes may have different sample formats available. Only the "mix format" (available from BASS_WASAPI_GetDeviceInfo) is generally supported in shared mode.

See also

BASS_WASAPI_Init