Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
[DllImportAttribute("bass")] public static bool BASS_ChannelUpdate( int handle, int length )
Parameters
- handle
- Type: SystemInt32
The channel handle... a HMUSIC or HSTREAM. - length
- Type: SystemInt32
The amount to render, in milliseconds... 0 = default (2 x BASS_CONFIG_UPDATEPERIOD). This is capped at the space available in the buffer.
Return Value
Type: BooleanIf successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
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 decoded for playback. Usually the delay is not noticeable or important, but if you need playback to start instantly when you call BASS_ChannelPlay(Int32, Boolean), then use this function first. The length parameter should be at least equal to the BASS_CONFIG_UPDATEPERIOD.
It may not always be possible to render the requested amount of data, in which case this function will still succeed. BASS_ChannelGetData(Int32, IntPtr, Int32) (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(Int32) to implement different update periods for different channels, instead of a single update period for all. Unlike BASS_Update(Int32), 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.
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not a valid channel. |
BASS_ERROR_NOTAVAIL | Decoding channels do not have playback buffers. |
BASS_ERROR_ENDED | The channel has ended. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
int stream = Bass.BASS_StreamCreateFile("afile.mp3", 0, 0, BASSFlag.BASS_STREAM_PRESCAN); // pre-buffer Bass.BASS_ChannelUpdate(stream, 0); // start playback Bass.BASS_ChannelPlay(stream, false);