BASS_ChannelUpdate

Updates the playback buffer of a stream or MOD music.

BOOL BASS_ChannelUpdate(
    DWORD handle,
    DWORD length
);

Parameters

handleThe channel handle... a HMUSIC or HSTREAM.
lengthThe amount of data to render, in milliseconds... 0 = default (2 x update period). This is capped at the space available in the buffer.

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_NOTAVAILDecoding channels do not have playback buffers.
BASS_ERROR_ENDEDThe channel has ended.
BASS_ERROR_ALREADYThe channel is already being updated.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

When starting playback of a stream or MOD music, after creating it or changing its position, there will be a slight delay while the initial data is generated for playback. Usually the delay is not noticeable or important, but if you need playback to start instantly when you call BASS_ChannelStart or BASS_ChannelPlay, then use this function first. The length parameter should be at least equal to the update period.

It may not always be possible to render the requested amount of data, in which case this function will still succeed. BASS_ChannelGetData (BASS_DATA_AVAILABLE) can be used to check how much data a channel has buffered for playback.

When automatic updating is disabled (BASS_CONFIG_UPDATEPERIOD = 0 or BASS_CONFIG_UPDATETHREADS = 0), this function could be used instead of BASS_Update to implement different update periods for different channels, instead of a single update period for all. Unlike BASS_Update, this function can also be used while automatic updating is enabled.

The CPU usage of this function is not included in the BASS_GetCPU reading, but is included in the channel's BASS_ATTRIB_CPU attribute value.

See also

BASS_ChannelStart, BASS_Update