BASS_CONFIG_BUFFER config option

The playback buffer length for HSTREAM and HMUSIC channels.

BASS_SetConfig(
    BASS_CONFIG_BUFFER,
    DWORD length
);

Parameters

lengthThe buffer length in milliseconds. The minimum length is 10ms, the maximum is 5000 milliseconds. If the length specified is outside this range, it is automatically capped.

Remarks

The default buffer length is 500 milliseconds. Increasing the length decreases the chance of the sound possibly breaking-up on slower computers, but also increases the latency for DSP/FX. The buffer length should always be greater than the update period (BASS_CONFIG_UPDATEPERIOD), which determines how often the buffer is refilled.

Small buffer lengths are only required if the sound is going to be changing in real-time, for example, in a soft-synth. If you need to use a small buffer, then the minbuf member of BASS_INFO should be used to get the recommended minimum buffer length supported by the device and its drivers, and add that to the update period plus some margin for the stream's processing. Even then, it is still possible that the sound could break up on some systems, it is also possible that smaller buffers may be fine. So when using small buffers, you should have an option in your software for the user to finetune the length used, for optimal performance.

Using this config option only affects the HMUSIC/HSTREAM channels that are created afterwards, not any that have already been created. So you can have channels with differing buffer lengths by using this config option each time before creating them. A channel's buffer length can be also reduced (or bypassed entirely) at any time via the BASS_ATTRIB_BUFFER attribute.

If automatic updating is disabled, make sure you call BASS_Update frequently enough to keep the buffers updated.

See also

BASS_GetConfig, BASS_GetInfo, BASS_SetConfig, BASS_ATTRIB_BUFFER, BASS_CONFIG_UPDATEPERIOD