Changes the track of a CD stream.
Namespace: Un4seen.Bass.AddOn.Cd
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
[DllImportAttribute("basscd")] public static bool BASS_CD_StreamSetTrack( int handle, int track )
Parameters
- handle
- Type: SystemInt32
The CD stream handle. - track
- Type: SystemInt32
The new track... 0 = the first track, BASS_CD_TRACK_PREGAP = 1st track pregap (not all drives support reading of the 1st track pregap).
Return Value
Type: BooleanIf successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
This function is identical to using the BASS_POS_CD_TRACK 'mode' with BASS_ChannelSetPosition(Int32, Int64, BASSMode). Either can be used with a BASS_SYNC_END sync (set via BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr)) to play one track after another.
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_NOCD | There's no CD in the drive. |
BASS_ERROR_CDTRACK | track is invalid. |
BASS_ERROR_NOTAUDIO | The track is not an audio track. |
Examples
private SYNCPROC _mySync; // make it global, so that the GC can not collect it ... // create CD stream int stream = BassCd.BASS_CD_StreamCreate(0, track, BASSFlag.BASS_DEFAULT | BASS_STREAM_AUTOFREE); _mySync = new SYNCPROC(EndSync); Bass.BASS_ChannelSetSync(stream, BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME, 0, _mySync, IntPtr.Zero); // start playing Bass.BASS_ChannelPlay(stream, false); ... private void EndSync(int handle, int channel, int data, IntPtr user) { // get current track int track = Utils.LowWord32(BassCd.BASS_CD_StreamGetTrack(channel)); // jump to next track BassCd.BASS_CD_StreamSetTrack(channel, track + 1); }
See Also