BASS.NET API for the Un4seen BASS Audio LibraryBassWasapiBASS_WASAPI_CheckFormat Method (Int32, Int32, Int32, BASSWASAPIFormat)BASS.NET API for the Un4seen BASS Audio Library
Checks if a particular sample format is supported by a device (endpoint) in exclusive mode.

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

public static BASSWASAPIFormat BASS_WASAPI_CheckFormat(
	int device,
	int freq,
	int chans,
	BASSWASAPIFormat format


Type: SystemInt32
The device to use... 0 = first device, -1 = default device, -2 = default input device. BASS_WASAPI_GetDeviceInfo(Int32, BASS_WASAPI_DEVICEINFO) can be used to enumerate the available devices.
Type: SystemInt32
The sample rate to check.
Type: SystemInt32
The number of channels to check... 1 = mono, 2 = stereo, etc.
Type: Un4seen.BassWasapiBASSWASAPIFormat
Limit the sample format that is used in exclusive mode. The default is to try 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 BASSWASAPIFormat value) is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

This overload always uses the BASS_WASAPI_EXCLUSIVE flag which will be applied automatically! The format parameter can be used to limit the sample format that is used in exclusive mode.

Call this method prior to BASS_WASAPI_Init(Int32, Int32, Int32, BASSWASAPIInit, Single, Single, WASAPIPROC, IntPtr) in order to make sure the requested format is supported by the Wasapi output device/driver (endpoint).

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

ERROR CODEDescription
BASS_ERROR_DEVICEThe device number specified is invalid.
BASS_ERROR_DRIVERThe driver could not be initialized.
BASS_ERROR_FORMATUnsupported sample format or number of channels.

See Also