NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
REL="HOME"
TITLE="SDL Library Documentation"
REL="UP"
TITLE="CD-ROM"
REL="PREVIOUS"
TITLE="SDL_CDOpen"
HREF="sdlcdopen.html"><
LINK
REL="NEXT"
TITLE="SDL_CDPlay"
HREF="sdlcdplay.html"><
/HEAD
CLASS="REFENTRY"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
CLASS="NAVHEADER"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation<
/TH
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
HREF="sdlcdopen.html"
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
HREF="sdlcdplay.html"
ALIGN="LEFT"
NAME="SDLCDSTATUS"
CLASS="REFNAMEDIV"
NAME="AEN6759"
>SDL_CDStatus -- Returns the current status of the given drive.<
/DIV
CLASS="REFSYNOPSISDIV"
NAME="AEN6762"
CLASS="FUNCSYNOPSIS"
NAME="AEN6763"
CLASS="FUNCSYNOPSISINFO"
CLASS="FUNCDEF"
CLASS="FSFUNC"
CLASS="FUNCSYNOPSISINFO"
>/* Given a status, returns true if there's a disk in the drive */
#define CD_INDRIVE(status) ((int)status > 0)</PRE
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN6770"
></A
><H2
>Description</H2
><P
>This function returns the current status of the given drive. Status is described like so:
<PRE
CLASS="PROGRAMLISTING"
>typedef enum {
CD_TRAYEMPTY,
CD_STOPPED,
CD_PLAYING,
CD_PAUSED,
CD_ERROR = -1
} CDstatus;</PRE
></P
><P
>If the drive has a CD in it, the table of contents of the CD and current
play position of the CD will be stored in the SDL_CD structure.</P
><P
>The macro <TT
CLASS="LITERAL"
>CD_INDRIVE</TT
> is provided for convenience,
and given a status returns true if there's a disk in the drive.<
/P
CLASS="NOTE"
CLASS="NOTE"
CLASS="FUNCTION"
HREF="sdlcd.html"
CLASS="STRUCTNAME"
> structure passed to it.<
/P
CLASS="REFSECT1"
NAME="AEN6782"
CLASS="PROGRAMLISTING"
>int playTrack(int track)
{
int playing = 0;
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
/* clamp to the actual number of tracks on the CD */
if (track >= cdrom->numtracks) {
track = cdrom->numtracks-1;
}
if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
playing = 1;
}
}
return playing;
CLASS="REFSECT1"
NAME="AEN6785"
HREF="sdlcd.html"
CLASS="FUNCTION"
CLASS="NAVFOOTER"
ALIGN="LEFT"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
WIDTH="33%"
ALIGN="left"
VALIGN="top"
HREF="sdlcdopen.html"
WIDTH="34%"
ALIGN="center"
VALIGN="top"
HREF="index.html"
WIDTH="33%"
ALIGN="right"
VALIGN="top"
HREF="sdlcdplay.html"
WIDTH="33%"
ALIGN="left"
VALIGN="top"
WIDTH="34%"
ALIGN="center"
VALIGN="top"
HREF="cdrom.html"
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>