BASS.NET API for the Un4seen BASS Audio LibraryBassCdBASS_CD_GetTrackLength Method BASS.NET API for the Un4seen BASS Audio Library
Retrieves the length (in bytes) of a track.

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

[DllImportAttribute("basscd.dll", CharSet = CharSet.Auto)]
public static int BASS_CD_GetTrackLength(
	int drive,
	int track
)

Parameters

drive
Type: SystemInt32
The drive... 0 = the first drive.
track
Type: SystemInt32
The track to retrieve the length of... 0 = the first track.

Return Value

Type: Int32
If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code. If successful, the length of the track is returned.
Remarks

CD audio is always 44100hz stereo 16-bit. That's 176400 bytes per second. So dividing the track length by 176400 gives the length in seconds.

See also: BASS_CD_GetTrackLengthSeconds(Int32, Int32) and BASS_CD_GetTrackPregap(Int32, Int32).

ERROR CODEDescription
BASS_ERROR_DEVICEdrive is invalid.
BASS_ERROR_NOCDThere's no CD in the drive.
BASS_ERROR_CDTRACKThe track number is invalid.
BASS_ERROR_NOTAUDIOThe track is not an audio track.

See Also

Reference