BASS

BASS_ATTRIB_FREQ attribute


The sample rate of a channel.

BASS_ChannelSetAttribute(
    DWORD handle,
    BASS_ATTRIB_FREQ,
    float freq
);

Parameters

handleThe channel handle.
freqThe sample rate... 0 = original rate (when the channel was created).

Remarks

This attribute applies to playback of the channel, and does not affect the channel's sample data, so it has no real effect on decoding channels. It is still adjustable then though, so that it can be used by the BASSmix add-on and anything else that wants to use it.

It is not possible to change the sample rate of a channel if the "with FX flag" DX8 effect implementation enabled on it, unless DirectX 9 or above is installed.

Increasing the sample rate of a stream or MOD music increases its CPU usage, and reduces the length of its playback buffer in terms of time. If you intend to raise the sample rate above the original rate, then you may also need to increase the buffer length via the BASS_CONFIG_BUFFER config option to avoid break-ups in the sound.

Platform-specific

On Windows, the sample rate will get rounded down to a whole number during playback.

See also

BASS_ChannelGetAttribute, BASS_ChannelSetAttribute, BASS_ChannelSlideAttribute, BASS_GetInfo