BASS.NET API for the Un4seen BASS Audio Library

BassBASS_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.17.5
Syntax

[DllImportAttribute("bass")]
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:
int length = (int)Bass.BASS_ChannelSeconds2Bytes(channel, 0.03);
See Also

Reference