BASS_ASIO_ChannelSetFormat

Sets a channel's sample format.

BOOL BASS_ASIO_ChannelSetFormat(
    BOOL input,
    DWORD channel,
    DWORD format
);

Parameters

inputDealing with an input channel? FALSE = an output channel.
channelThe input/output channel number... 0 = first.
formatThe sample format. One of the following.
BASS_ASIO_FORMAT_16BIT16-bit integer.
BASS_ASIO_FORMAT_24BIT24-bit integer.
BASS_ASIO_FORMAT_32BIT32-bit integer.
BASS_ASIO_FORMAT_32BIT2432-bit integer with 24-bit alignment.
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 (TPDF) when converting from floating-point to integer.

Return value

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

Error codes

BASS_ERROR_INITBASS_ASIO_Init has not been successfully called.
BASS_ERROR_ILLPARAMThe input and channel combination is invalid.
BASS_ERROR_FORMATThe requested format conversion is not available.

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.

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.

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

Example

Set output channel 0 to use floating-point sample data.
BASS_ASIO_ChannelSetFormat(FALSE, 0, BASS_ASIO_FORMAT_FLOAT);

See also

BASS_ASIO_ChannelGetFormat, BASS_ASIO_ChannelGetInfo, ASIOPROC callback