BASS_CD_StreamCreateEx
Creates a sample stream from an audio CD track, optionally providing a callback function to receive sub-channel data and/or C2 error info.
HSTREAM BASS_CD_StreamCreateEx(
DWORD drive,
DWORD track,
DWORD flags,
CDDATAPROC *proc,
void *user
);
Parameters
drive | The drive... 0 = the first drive.
|
track | The track... 0 = the first track, BASS_CD_TRACK_PREGAP = 1st track pregap (not all drives support reading of the 1st track pregap).
|
flags | Any combination of these flags.
BASS_SAMPLE_FLOAT | Use 32-bit floating-point sample data. See Floating-point channels for info.
| BASS_SAMPLE_LOOP | Loop the file. This flag can be toggled at any time using BASS_ChannelFlags.
| BASS_STREAM_AUTOFREE | Automatically free the stream when playback ends.
| BASS_STREAM_DECODE | Decode the sample data, without playing it. Use BASS_ChannelGetData to retrieve decoded sample data. The BASS_STREAM_AUTOFREE and SPEAKER flags cannot be used together with this flag.
| BASS_SPEAKER_xxx | Speaker assignment flags.
| BASS_CD_SUBCHANNEL | Read sub-channel data. 96 bytes of de-interleaved sub-channel data will be inserted after each 2352 bytes of audio data or delivered to the provided CDDATAPROC. This flag cannot be used without the BASS_STREAM_DECODE flag or with the BASS_SAMPLE_FLOAT flag, unless a CDDATAPROC is provided to receive the sub-channel data.
| BASS_CD_SUBCHANNEL_NOHW | Read sub-channel data, without using any hardware de-interleaving. This is identical to the BASS_CD_SUBCHANNEL flag, except that the de-interleaving is always performed by BASSCD even if the drive is apparently capable of de-interleaving itself.
| BASS_CD_C2ERRORS | Include C2 error info. 296 bytes of C2 error info is inserted after each 2352 bytes of audio data (and optionally 96 bytes of sub-channel data) or delivered to the provided CDDATAPROC. The first 294 bytes contain the C2 error bits (one bit for each byte of audio), followed by a byte containing the logical "OR" of all 294 bytes, which can be used to quickly check if there were any C2 errors. The final byte is just padding. This flag cannot be used without the BASS_STREAM_DECODE flag or with the BASS_SAMPLE_FLOAT flag, unless a CDDATAPROC is provided to receive the C2 error info.
|
|
proc | A callback function to receive sub-channel data and C2 error info... NULL = no callback. If a callback function is provided, sub-channel data and C2 error info will be delivered to it rather than being inserted amongst the sample data.
|
user | User instance data to pass to the callback function.
|
Return value
If successful, the new stream's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_INIT | BASS_Init has not been successfully called.
|
BASS_ERROR_DEVICE | drive is invalid.
|
BASS_ERROR_ALREADY | A stream using this drive already exists.
|
BASS_ERROR_ILLPARAM | The BASS_CD_SUBCHANNEL and BASS_CD_C2ERRORS flags cannot be used without the BASS_STREAM_DECODE flag or with the BASS_SAMPLE_FLOAT flag, unless a CDDATAPROC is provided.
|
BASS_ERROR_NOCD | There is no CD in the drive.
|
BASS_ERROR_CDTRACK | track is invalid.
|
BASS_ERROR_NOTAUDIO | The track is not an audio track.
|
BASS_ERROR_NOTAVAIL | Reading sub-channel data and/or C2 error info is not supported by the drive, or a read offset is in effect, in which case a CDDATAPROC must be provided to receive sub-channel data or C2 error info.
|
BASS_ERROR_FORMAT | The sample format is not supported.
|
BASS_ERROR_SPEAKER | The specified SPEAKER flags are invalid.
|
BASS_ERROR_MEM | There is insufficient memory.
|
BASS_ERROR_UNKNOWN | Some other mystery problem!
|
Remarks
This function is identical to BASS_CD_StreamCreate, but with the additional option of providing a callback function to receive sub-channel data and C2 error info.
See also
BASS_CD_GetTracks, BASS_CD_StreamCreate, BASS_CD_StreamCreateFileEx, BASS_CD_StreamSetTrack
BASS_ChannelGetInfo, BASS_ChannelGetLength, BASS_ChannelPlay, BASS_ChannelSetAttribute, BASS_ChannelSetDSP, BASS_ChannelSetFX, BASS_ChannelSetLink, BASS_StreamFree