BASS_ASIO_ChannelSetRate


Sets a channel's sample rate.

BOOL BASS_ASIO_ChannelSetRate(
    BOOL input,
    DWORD channel,
    double rate
);

Parameters

inputDealing with an input channel? FALSE = an output channel.
channelThe input/output channel number... 0 = first.
rateThe sample rate... 0 = device rate.

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, or rate is below 0.
BASS_ERROR_FORMATResampling is not supported for the channel's sample format.

Remarks

For optimal sound quality and performance, it is best to set the device to the wanted sample rate via BASS_ASIO_SetRate, but that is not always possible, which is where this function comes into play. 16 point sinc interpolation is used in the sample rate conversion, giving a good blend of sound quality and performance.

When a channel's sample rate is the same as the device rate, resampling is bypassed, so there is no unnecessary performance hit.

Resampling is not supported when the sample format is DSD.

Example

Set both the device and channel rate, to avoid unnecessary resampling on the channel whenever possible.
BASS_ASIO_SetRate(44100); // set the device rate
BASS_ASIO_ChannelSetRate(FALSE, 0, 44100); // set the channel's rate

See also

BASS_ASIO_ChannelGetInfo, BASS_ASIO_ChannelGetRate, BASS_ASIO_ChannelSetFormat, BASS_ASIO_SetRate