BASS.NET API for the Un4seen BASS Audio Library

BassAsioBASS_ASIO_ChannelSetFormat Method

BASS.NET API for the Un4seen BASS Audio Library
Sets a channel's sample format.

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

[DllImportAttribute("bassasio")]
public static bool BASS_ASIO_ChannelSetFormat(
	bool input,
	int channel,
	BASSASIOFormat format
)

Parameters

input
Type: SystemBoolean
Dealing with an input channel? = an output channel.
channel
Type: SystemInt32
The input/output channel number... 0 = first.
format
Type: Un4seen.BassAsioBASSASIOFormat
The sample format. One of the following (see BASSASIOFormat):
BASS_ASIO_FORMAT_16BIT16-bit integer.
BASS_ASIO_FORMAT_24BIT24-bit integer.
BASS_ASIO_FORMAT_32BIT32-bit integer.
BASS_ASIO_FORMAT_FLOAT32-bit floating-point.
BASS_ASIO_FORMAT_DSD_LSBDSD with LSB first.
BASS_ASIO_FORMAT_DSD_MSBDSD with MSB first.
BASS_ASIO_FORMAT_DITHERflag: apply dither (TDPF) to the output.

Return Value

Type: Boolean
If succesful, then is returned, else is returned. Use BASS_ASIO_ErrorGetCode to get the error code.
Remarks

The sample format can vary between ASIO devices/drivers, which could mean a lot of extra/duplicate code being required. To avoid that extra work, BASSASIO can automatically convert the sample data, whenever necessary, to/from a format of your choice. The native format of a channel can be retrieved via BASS_ASIO_ChannelGetInfo(Boolean, Int32, BASS_ASIO_CHANNELINFO).

The PCM format options are only available when the device's format is PCM, and the DSD format options are only available when the device's format is DSD. If a device supports both, it can be switched between DSD and PCM via BASS_ASIO_SetDSD(Boolean).

For performance reasons, it's best not to use 24-bit sample data whenever possible, as 24-bit data requires a bit more processing than the other formats.

ERROR CODEDescription
BASS_ERROR_INITBASS_ASIO_Init(Int32, BASSASIOInit) has not been successfully called.
BASS_ERROR_ILLPARAMThe input and channel combination is invalid, or format is.
BASS_ERROR_FORMATFormat conversion is not available for the channel's native sample format (please report).

Examples

Set output channel 0 to use floating-point sample data:
BassAsio.BASS_ASIO_ChannelSetFormat(false, 0, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT);
See Also

Reference