Retrieves the playback length of a channel.
|handle||The channel handle... a HCHANNEL, HMUSIC, HSTREAM. HSAMPLE handles may also be used.
|mode||How to retrieve the length. One of the following.|
other modes may be supported by add-ons, see the documentation.
|BASS_POS_BYTE||Get the length in bytes.
|BASS_POS_MUSIC_ORDER||Get the length in orders. (HMUSIC only)
|BASS_POS_OGG||Get the number of bitstreams in an OGG file.
If successful, then the channel's length is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
|BASS_ERROR_HANDLE||handle is not valid.
|BASS_ERROR_NOTAVAIL||The requested length is not available.
The exact length of a stream will be returned once the whole file has been streamed, but until then it is not always possible to 100% accurately estimate the length. The length is always exact for MP3/MP2/MP1 files when the BASS_STREAM_PRESCAN flag is used in the BASS_StreamCreateFile call, otherwise it is an (usually accurate) estimation based on the file size. The length returned for OGG files will usually be exact (assuming the file is not corrupt), but when streaming from the internet (or "buffered" user file), it can be a very rough estimation until the whole file has been downloaded. It will also be an estimate for chained OGG files that are not pre-scanned.
Unless an OGG file contains a single bitstream, the number of bitstreams it contains will only be available if it was pre-scanned at the stream's creation.
Retrieving the byte length of a MOD music requires that the BASS_MUSIC_PRESCAN flag was used in the BASS_MusicLoad call.
Get the duration (in seconds) of a channel.
QWORD len=BASS_ChannelGetLength(channel, BASS_POS_BYTE); // the length in bytes
double time=BASS_ChannelBytes2Seconds(channel, len); // the length in seconds
BASS_ChannelBytes2Seconds, BASS_ChannelGetPosition, BASS_ChannelSetPosition, BASS_StreamGetFilePosition