User defined CD data callback function.

void CALLBACK CDDataProc(
    HSTREAM handle,
    int pos,
    DWORD type,
    const void *buffer,
    DWORD length,
    void *user


handleThe CD stream that provided the data.
posThe stream position (in bytes) that the data is from.
typeThe type of data, which can be one of the following.
BASS_CD_DATA_C2C2 error info.
bufferPointer to the data.
lengthThe amount of data in bytes.
userThe user instance data given when BASS_CD_StreamCreateEx or BASS_CD_StreamCreateFileEx was called.


Sub-channel data or C2 error info is delivered to this function as soon as it is read from the CD, before the associated audio data is played, or delivered by BASS_ChannelGetData in the case of a decoding channel. The pos value can be used to synchronize the delivered data with the stream's audio data.

CDs are read from in units of a frame, and so this function will always receive a whole number of frames' worth of data; there are 96 bytes of sub-channel data per-frame, and 296 bytes of C2 error info. When BASS_CD_SetOffset has been used to set a read offset, playback may begin mid-frame, and as a result of that, pos may start out negative because the delivered data is from the start of the 1st frame, before where playback will begin from.

Neither sub-channel data or C2 error info will be delivered in the case of a silenced frame resulting from the BASS_CONFIG_CD_SKIPERROR config option being enabled.

See also

BASS_CD_StreamCreateEx, BASS_CD_StreamCreateFileEx