BASS_CONFIG_DEV_BUFFER config option


The output device buffer length.

BASS_SetConfig(
    BASS_CONFIG_DEV_BUFFER,
    DWORD length
);

Parameters

lengthThe buffer length in milliseconds.

Remarks

The device buffer is where the final mix of all playing channels is placed, ready for the device to play. Its length affects the latency of things like starting and stopping playback of a channel, so you will probably want to avoid setting it unnecessarily high, but setting it too short could result in breaks in the output.

When using a large device buffer, the BASS_ATTRIB_NOBUFFER attribute could be used to skip the channel buffering stage, to avoid further increasing latency for real-time generated sound and/or DSP/FX changes.

Changes to this config setting only affect subsequently initialized devices, not any that are already initialized.

Platform-specific

This config option is available on Linux, Android, and Windows CE. The device's buffer is determined automatically on other platforms.

On Linux, BASS will attempt to set the device buffer-feeding thread to real-time priority (as on other platforms) to reduce the chances of it getting starved of CPU, but if that is not possible (eg. the user account lacks permission) then it may be necessary to increase the buffer length to avoid breaks in the output when the CPU is busy. The driver may also choose to use a different buffer length if it decides that the specified length is too short or long. The buffer length actually being used can be obtained with BASS_INFO, like this: latency + minbuf / 2.

See also

BASS_GetConfig, BASS_GetInfo, BASS_Init, BASS_SetConfig, BASS_ATTRIB_NOBUFFER