Japanese
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


〈 OPEN〉 ,〈 NODISC〉 For information on opening and closing the tray in this state, see Initializing the CD Block ( CDC_CdInit ).

 one
View
table
 Title

function specification

 Function

CD playback

 Function Name[SR]

CDC_CdPlay

 No

2.1

Format
Sint32 CDC_CdPlay(CdcPly *ply)
input
ply: playback parameter
output
none
function value
Returns an error code.
function
Plays the CD according to the specified playback parameters.
The CD-DA area plays music, and the CD-ROM area reads sector data.
Do not play the gap/pause area at the boundary between CD-ROM and CD-DA.

Note
To play CD-DA and actually output audio, separate SCSP settings are required. Please refer to the SCSP manual for the setting method.

remarks
When playing a CD-DA, muting is canceled 4 frames before the start position to prevent the beginning of the song from being cut off.

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; /* Play mode */
ret = CDC_CdPlay(ply); /* Start playing */

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

(3) Specifying default values
CdcPly plywk, *ply=&plywk;
CDC_PLY_STYPE(ply)=CDC_PTYPE_DFL; /* Starting position is at the beginning of the disk */
CDC_PLY_ETYPE(ply)=CDC_PTYPE_DFL; /* End position is at the end of the disk */
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);


 one
View
table
 Title

function specification

 Function

Seek playback position

 Function Name[SR]

CDC_CdSeek

 No

2.2

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

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

example
(1) Frame address specification
Sint32 ret;
CdcPos poswk, *pos=&poswk; /* Definition of positional parameter variable */
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) Stopping CD playback (default value: seek to home position)...stop
CdcPosposwk, *pos=&poswk;
CDC_POS_PTYPE(pos)=CDC_PTYPE_DFL;
ret = CDC_CdSeek(pos);

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


 one
View
table
 Title

function specification

 Function

scan playback

 Function Name[SR]

CDC_CdScan

 No

2.3

Format
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 outside the playback range, scanning is canceled and paused. The pose position at that time is undefined.

(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
〈 PLAY〉 If you perform scan playback from this state, -12dB of sound will be output in the CD-DA area.
CD-ROM area and〈 PAUSE〉 If you perform scan playback in this state, the audio will be muted.

remarks
When scanning and playing the CD-ROM area, sector data is not read. If you try to reverse the scan direction near the playback range boundary, you may end up outside the playback range. When reversing, be careful near the boundary (within 3 to 6 seconds).


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