BASS_ATTRIB_BUFFER attribute


Playback buffering length.

BASS_ChannelSetAttribute(
    DWORD handle,
    BASS_ATTRIB_BUFFER,
    float buffer
);

Parameters

handleThe channel handle... a HMUSIC or HSTREAM.
bufferThe buffering length in seconds... 0 = no buffering. This is automatically capped to the full length of the channel's playback buffer.

Remarks

This attribute allows the amount of playback buffering to be changed without recreating the channel to get a new buffer. It limits how much data the update thread(s) or the BASS_Update function will try to keep in the playback buffer; it cannot exceed the length of the buffer, determined by the BASS_CONFIG_BUFFER setting at the time of its creation. BASS_ChannelUpdate is unaffected and can still be used to fill the entire buffer. Push streams (using STREAMPROC_PUSH) are also unaffected; they will always place as much data as possible in their playback buffers.

When this attribute is set to 0, no data will be buffered and the channel will only be asked to produce data as it is needed during the generation of the final mix. This allows the lowest latency to be achieved, but also imposes tighter timing requirements on the channel to produce its data and apply any DSP/FX (and run mixtime syncs) that are set on it; if too long is taken, there will be a break in the output, affecting all channels that are playing on the same device. The channel's data is still placed in its playback buffer, which allows BASS_ChannelGetData and BASS_ChannelGetLevel to be used, although there is likely to be less data available to them due to the buffer being less full.

This attribute can be changed mid-playback. Any excess data that is currently in the playback buffer will still be played but not replaced.

The default value is the channel's full playback buffer length, as determined by the BASS_CONFIG_BUFFER setting at the time of its creation.

Platform-specific

This attribute is not available when using DirectSound output on Windows, as BASS does not generate the final mix.

See also

BASS_ChannelGetAttribute, BASS_ChannelSetAttribute