Retrieves the length (in bytes) of a track.

DWORD BASS_CD_GetTrackLength(
    DWORD drive,
    DWORD track


driveThe drive... 0 = the first drive.
trackThe track to retrieve the length of... 0 = the first track.

Return value

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

Error codes

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


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

See also

BASS_CD_GetTrackPregap, BASS_CD_GetTracks