PROGRAMMER'S GUIDECD communication I / F (CD part)
BackForward
CD Communication Interface User's Manual (CD Part)

Function details-2


8.2.2 CD drive


For opening and closing the tray in the <OPEN> and <NODISC> states, refer to Initializing the CD block (CDC_CdInit).

 List
 Title

Function specifications

 Function

CD playback

 Function Name [SR]

CDC_CdPlay

 No

2.1

Form
Sint32 CDC_CdPlay (CdcPly * ply)
input
ply: playback parameters
output
none
Function value
Returns an error code.
function
Plays the CD according to the specified playback parameters.
Music is played in the CD-DA area, and sector data is read in the CD-ROM area.
Do not play the gap / pause area at the boundary between the CD-ROM and the CD-DA.

caution
To play the CD-DA and actually output the audio, it is necessary to set SCSP separately. Refer to the SCSP manual for the setting method.

remarks
When playing a CD-DA, the mute is released 4 frames before the start position to prevent the beginning of the song.

example
(1) Frame address specification
Sint32 ret;
CdcPly plywk, * ply = & plywk; / * Definition of playback parameter variables * /
CDC_PLY_STYPE (ply) = CDC_PTYPE_FAD;
CDC_PLY_SFAD (ply) = fad; / * Start frame address * /
CDC_PLY_ETYPE (ply) = CDC_PTYPE_FAD;
CDC_PLY_EFAS (ply) = fasnum; / * Number of frame address sectors * /
CDC_PLY_PMODE (ply) = pmode; / * Playback mode * /
ret = CDC_CdPlay (ply); / * Start playback * /

(2) Track / index specification
CdcPly plywk, * ply = & plywk;
CDC_PLY_STYPE (ply) = CDC_PTYPE_TNO;
CDC_PLY_STNO (ply) = tno1; / * Start track number * /
CDC_PLY_SIDX (ply) = x1; / * Starting index number * /
CDC_PLY_ETYPE (ply) = CDC_PTYPE_TNO;
CDC_PLY_ETNO (ply) = tno2; / * End track number * /
CDC_PLY_EIDX (ply) = x2; / * End index number * /
CDC_PLY_PMODE (ply) = pmode; / * Playback mode * /
ret = CDC_CdPlay (ply);

(3) Specifying the default value
CdcPly plywk, * ply = & plywk;
CDC_PLY_STYPE (ply) = CDC_PTYPE_DFL; / * Start position is at the beginning of the disc * /
CDC_PLY_ETYPE (ply) = CDC_PTYPE_DFL; / * End position is at the end of the disc * /
CDC_PLY_PMODE (ply) = CDC_PM_DFL; / * No repeat, move pickup * /
ret = CDC_CdPlay (ply);

(4) Resume CD playback (unchanged specification: play from current position) …… Cancel pause
CdcPly plywk, * ply = & plywk;
CDC_PLY_STYPE (ply) = CDC_PTYPE_NOCHG;
CDC_PLY_ETYPE (ply) = CDC_PTYPE_NOCHG;
CDC_PLY_PMODE (ply) = CDC_PM_NOCHG;
ret = CDC_CdPlay (ply);


 List
 Title

Function specifications

 Function

Seek playback position

 Function Name [SR]

CDC_CdSeek

 No

2.2

Form
Sint32 CDC_CdSeek (CdcPos * pos)
input
pos: Positional parameters
output
none
Function value
Returns an error code.
function
Moves (seeks) the playback position (pickup) according to the specified position parameter.

caution
If you use the stop command at the end of CD playback, it will be slower when you access the CD again. As long as you continue to access the CD, you should usually use the pause command.

example
(1) Frame address specification
Sint32 ret;
CdcPos poswk, * pos = & poswk; / * Definition of position parameter variables * /
CDC_POS_PTYPE (pos) = CDC_PTYPE_FAD;
CDC_POS_FAD (pos) = fad; / * frame address * /
ret = CDC_CdSeek (pos); / * Start seek * /

(2) Track / index specification
CdcPos poswk, * pos = & poswk;
CDC_POS_PTYPE (pos) = CDC_PTYPE_TNO;
CDC_POS_TNO (pos) = tno; / * Track number * /
CDC_POS_IDX (pos) = x; / * Index number * /
ret = CDC_CdSeek (pos);

(3) Cancel CD playback (specify default value: seek to home position) …… Stop
CdcPos poswk, * pos = & poswk;
CDC_POS_PTYPE (pos) = CDC_PTYPE_DFL;
ret = CDC_CdSeek (pos);

(4) Pause CD playback (unchanged specification: seek to current position) …… Pause
CdcPos poswk, * pos = & poswk;
CDC_POS_PTYPE (pos) = CDC_PTYPE_NOCHG;
ret = CDC_CdSeek (pos);


 List
 Title

Function specifications

 Function

Scan playback

 Function Name [SR]

CDC_CdScan

 No

2.3

Form
Sint32 CDC_CdScan (Sint32 scandir)
input
scandir: Scan direction
output
none
Function value
Returns an error code.
function
Scan and play the CD. Continue scanning until a CD drive command (CD play, seek, etc.) is issued. When it reaches the outside of the playback range, the scan is canceled and the pose is set. The pose position at that time is indefinite.

(1) Scan direction
 Constant name
 explanation
 CDC_SCAN_FWD
 Fast forward playback (forward scan)
 CDC_SCAN_RVS
 Fast rewind playback (reverse scan)

(2) Audio output
When scanning and playing from the <PLAY> state, -12 dB of sound is output in the CD-DA area.
If you scan and play back in the CD-ROM area or in the <PAUSE> state, the sound will be muted.

remarks
When scanning and playing back the CD-ROM area, the sector data will not be read. If you try to reverse the scanning direction near the playback range boundary, you may go out of the playback range. When reversing, pay attention to the vicinity of the boundary (within 3 to 6 seconds).


BackForward
PROGRAMMER'S GUIDECD communication I / F (CD part)
Copyright SEGA ENTERPRISES, LTD., 1997