BASS.NET API for the Un4seen BASS Audio Library

BassWasapiBASS_WASAPI_CheckFormat Method (Int32, Int32, Int32, BASSWASAPIInit)

BASS.NET API for the Un4seen BASS Audio Library
Checks if a particular sample format is supported by a device (endpoint).

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

[DllImportAttribute("basswasapi")]
public static BASSWASAPIFormat BASS_WASAPI_CheckFormat(
	int device,
	int freq,
	int chans,
	BASSWASAPIInit flags
)

Parameters

device
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.
freq
Type: SystemInt32
The sample rate to check.
chans
Type: SystemInt32
The number of channels to check... 1 = mono, 2 = stereo, etc.
flags
Type: Un4seen.BassWasapiBASSWASAPIInit
Any combination of these flags (see BASSWASAPIInit):
BASS_WASAPI_SHAREDCheck the device in shared mode.
BASS_WASAPI_EXCLUSIVECheck the device in exclusive mode. The HIWORD - use Utils.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

Type: BASSWASAPIFormat
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.
Remarks

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_WASAPIWASAPI is not available.
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

Reference