BASS_ASIO_ChannelSetFormat
Sets a channel's sample format.
BOOL BASS_ASIO_ChannelSetFormat(
BOOL input,
DWORD channel,
DWORD format
);
Parameters
input | Dealing with an input channel? FALSE = an output channel.
|
channel | The input/output channel number... 0 = first.
|
format | The sample format. One of the following.
BASS_ASIO_FORMAT_16BIT | 16-bit integer.
| BASS_ASIO_FORMAT_24BIT | 24-bit integer.
| BASS_ASIO_FORMAT_32BIT | 32-bit integer.
| BASS_ASIO_FORMAT_32BIT24 | 32-bit integer with 24-bit alignment.
| BASS_ASIO_FORMAT_FLOAT | 32-bit floating-point.
| BASS_ASIO_FORMAT_DSD_LSB | DSD with LSB first.
| BASS_ASIO_FORMAT_DSD_MSB | DSD with MSB first.
| BASS_ASIO_FORMAT_DITHER | Flag: 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_INIT | BASS_ASIO_Init has not been successfully called.
|
BASS_ERROR_ILLPARAM | The input and channel combination is invalid.
|
BASS_ERROR_FORMAT | The 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