Retrieves the drive and track number of a CD stream.

DWORD BASS_CD_StreamGetTrack(
    HSTREAM handle


handleThe CD stream handle.

Return value

If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code. If successful, the track number is returned in the low word (low 16-bits), and the drive is returned in the high word (high 16-bits).

Error codes

BASS_ERROR_HANDLEhandle is not valid.


If the track has just changed, this function will give the new track number even if the old track is still being heard due to buffering. The BASS_POS_CD_TRACK "mode" can be used with BASS_ChannelGetPosition to get the track currently being heard.


Check if a BASS channel is a CD stream, and then display its drive and track number.
DWORD track = BASS_CD_StreamGetTrack(handle);
if (track != -1) // it is a CD stream
    printf("drive = %d, track = %d\n", HIWORD(track), LOWORD(track));

See also

BASS_CD_StreamCreate, BASS_CD_StreamSetTrack