BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_ChannelSeconds2Bytes Method BASS.NET API for the Un4seen BASS Audio Library
Translates a time (seconds) position into bytes, based on a channel's format.

Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[DllImportAttribute("bass.dll", CharSet = CharSet.Unicode)]
public static long BASS_ChannelSeconds2Bytes(
	int handle,
	double pos
)

Parameters

handle
Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD. HSAMPLE handles may also be used.
pos
Type: SystemDouble
The position to translate (in seconds, e.g. 0.03 = 30ms).

Return Value

Type: Int64
If successful, then the translated length in BYTES is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

The translation is based on the channel's initial sample rate, when it was created.

The return value is rounded down to the position of the nearest sample.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.

Examples

Get the length of a 30ms window:
VB
Dim length As Integer = CInt(Bass.BASS_ChannelSeconds2Bytes(channel, 0.03))
int length = (int)Bass.BASS_ChannelSeconds2Bytes(channel, 0.03);
See Also

Reference