Translates a byte position into time (seconds), based on a channel's format.
Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
[DllImportAttribute("bass")] public static double BASS_ChannelBytes2Seconds( int handle, long pos )
Parameters
- handle
- Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD. HSAMPLE handles may also be used. - pos
- Type: SystemInt64
The position in BYTES to translate.
Return Value
Type: DoubleIf successful, then the translated length in seconds is returned, else a negative value is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not a valid channel. |
Examples
// length in bytes long len = Bass.BASS_ChannelGetLength(channel); // position in bytes long pos = Bass.BASS_ChannelGetPosition(channel); // the total time length double totaltime = Bass.BASS_ChannelBytes2Seconds(channel, len); // the elapsed time length double elapsedtime = Bass.BASS_ChannelBytes2Seconds(channel, pos); double remainingtime = totaltime - elapsedtime;
See Also