BASS_CD_GetTOC

Retrieves the TOC from the CD in a drive.

BOOL BASS_CD_GetTOC(
    DWORD drive,
    DWORD mode,
    BASS_CD_TOC *toc
);

Parameters

driveThe drive to get info on... 0 = the first drive.
modeOptionally, the following.
BASS_CD_TOC_INDEX
+ track number (0=first)
Get the position of a track's indexes.
BASS_CD_TOC_TIMEGet the track (or index) start address in time form, else in LBA form.
tocPointer to a structure to receive the TOC.

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_DEVICEdrive is invalid.
BASS_ERROR_NOCDThere is no CD in the drive.
BASS_ERROR_CDTRACKAn invalid track was requested with BASS_CD_TOC_INDEX.

Remarks

This function gives the TOC in the form that it is delivered by the drive, except that the byte order may be changed to match the system's native byte order (the TOC is originally big-endian).

Example

List the TOC track entries on the CD in the first drive, using time addressing.
BASS_CD_TOC toc;
if (BASS_CD_GetTOC(0, BASS_CD_TOC_TIME, &toc)) {
    int a;
    for (a = 0; a < toc.size / sizeof(BASS_CD_TOC_TRACK); a++) {
        printf("track %u: adrcon=%x start=%02u:%02u:%02u\n",
            toc.tracks[a].track, toc.tracks[a].adrcon, toc.tracks[a].hmsf[1], toc.tracks[a].hmsf[2], toc.tracks[a].hmsf[3]);
    }
}

See also

BASS_CD_TOC structure