1<HTML 2><HEAD 3><TITLE 4>CD-ROM</TITLE 5><META 6NAME="GENERATOR" 7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8"><LINK 9REL="HOME" 10TITLE="SDL Library Documentation" 11HREF="index.html"><LINK 12REL="UP" 13TITLE="SDL Reference" 14HREF="reference.html"><LINK 15REL="PREVIOUS" 16TITLE="SDL_CloseAudio" 17HREF="sdlcloseaudio.html"><LINK 18REL="NEXT" 19TITLE="SDL_CDNumDrives" 20HREF="sdlcdnumdrives.html"><META 21NAME="KEYWORD" 22CONTENT="cdrom"><META 23NAME="KEYWORD" 24CONTENT="function"></HEAD 25><BODY 26CLASS="CHAPTER" 27BGCOLOR="#FFF8DC" 28TEXT="#000000" 29LINK="#0000ee" 30VLINK="#551a8b" 31ALINK="#ff0000" 32><DIV 33CLASS="NAVHEADER" 34><TABLE 35SUMMARY="Header navigation table" 36WIDTH="100%" 37BORDER="0" 38CELLPADDING="0" 39CELLSPACING="0" 40><TR 41><TH 42COLSPAN="3" 43ALIGN="center" 44>SDL Library Documentation</TH 45></TR 46><TR 47><TD 48WIDTH="10%" 49ALIGN="left" 50VALIGN="bottom" 51><A 52HREF="sdlcloseaudio.html" 53ACCESSKEY="P" 54>Prev</A 55></TD 56><TD 57WIDTH="80%" 58ALIGN="center" 59VALIGN="bottom" 60></TD 61><TD 62WIDTH="10%" 63ALIGN="right" 64VALIGN="bottom" 65><A 66HREF="sdlcdnumdrives.html" 67ACCESSKEY="N" 68>Next</A 69></TD 70></TR 71></TABLE 72><HR 73ALIGN="LEFT" 74WIDTH="100%"></DIV 75><DIV 76CLASS="CHAPTER" 77><H1 78><A 79NAME="CDROM" 80></A 81>Chapter 11. CD-ROM</H1 82><DIV 83CLASS="TOC" 84><DL 85><DT 86><B 87>Table of Contents</B 88></DT 89><DT 90><A 91HREF="sdlcdnumdrives.html" 92>SDL_CDNumDrives</A 93> -- Returns the number of CD-ROM drives on the system.</DT 94><DT 95><A 96HREF="sdlcdname.html" 97>SDL_CDName</A 98> -- Returns a human-readable, system-dependent identifier for the CD-ROM.</DT 99><DT 100><A 101HREF="sdlcdopen.html" 102>SDL_CDOpen</A 103> -- Opens a CD-ROM drive for access.</DT 104><DT 105><A 106HREF="sdlcdstatus.html" 107>SDL_CDStatus</A 108> -- Returns the current status of the given drive.</DT 109><DT 110><A 111HREF="sdlcdplay.html" 112>SDL_CDPlay</A 113> -- Play a CD</DT 114><DT 115><A 116HREF="sdlcdplaytracks.html" 117>SDL_CDPlayTracks</A 118> -- Play the given CD track(s)</DT 119><DT 120><A 121HREF="sdlcdpause.html" 122>SDL_CDPause</A 123> -- Pauses a CDROM</DT 124><DT 125><A 126HREF="sdlcdresume.html" 127>SDL_CDResume</A 128> -- Resumes a CDROM</DT 129><DT 130><A 131HREF="sdlcdstop.html" 132>SDL_CDStop</A 133> -- Stops a CDROM</DT 134><DT 135><A 136HREF="sdlcdeject.html" 137>SDL_CDEject</A 138> -- Ejects a CDROM</DT 139><DT 140><A 141HREF="sdlcdclose.html" 142>SDL_CDClose</A 143> -- Closes a SDL_CD handle</DT 144><DT 145><A 146HREF="sdlcd.html" 147>SDL_CD</A 148> -- CDROM Drive Information</DT 149><DT 150><A 151HREF="sdlcdtrack.html" 152>SDL_CDtrack</A 153> -- CD Track Information Structure</DT 154></DL 155></DIV 156><P 157>SDL supports audio control of up to 32 local CD-ROM drives at once.</P 158><P 159>You use this API to perform all the basic functions of a CD player, 160including listing the tracks, playing, stopping, and ejecting the CD-ROM. 161(Currently, multi-changer CD drives are not supported.)</P 162><P 163>Before you call any of the SDL CD-ROM functions, you must first call 164"<TT 165CLASS="FUNCTION" 166>SDL_Init(SDL_INIT_CDROM)</TT 167>", which scans the system for 168CD-ROM drives, and sets the program up for audio control. Check the 169return code, which should be <SPAN 170CLASS="RETURNVALUE" 171>0</SPAN 172>, to see if there 173were any errors in starting up.</P 174><P 175>After you have initialized the library, you can find out how many drives 176are available using the <TT 177CLASS="FUNCTION" 178>SDL_CDNumDrives()</TT 179> function. 180The first drive listed is the system default CD-ROM drive. After you have 181chosen a drive, and have opened it with <TT 182CLASS="FUNCTION" 183>SDL_CDOpen()</TT 184>, 185you can check the status and start playing if there's a CD in the drive.</P 186><P 187>A CD-ROM is organized into one or more tracks, each consisting of a certain 188number of "frames". Each frame is ~2K in size, and at normal playing speed, 189a CD plays 75 frames per second. SDL works with the number of frames on a 190CD, but this can easily be converted to the more familiar minutes/seconds 191format by using the <TT 192CLASS="FUNCTION" 193>FRAMES_TO_MSF()</TT 194> macro.</P 195></DIV 196><DIV 197CLASS="NAVFOOTER" 198><HR 199ALIGN="LEFT" 200WIDTH="100%"><TABLE 201SUMMARY="Footer navigation table" 202WIDTH="100%" 203BORDER="0" 204CELLPADDING="0" 205CELLSPACING="0" 206><TR 207><TD 208WIDTH="33%" 209ALIGN="left" 210VALIGN="top" 211><A 212HREF="sdlcloseaudio.html" 213ACCESSKEY="P" 214>Prev</A 215></TD 216><TD 217WIDTH="34%" 218ALIGN="center" 219VALIGN="top" 220><A 221HREF="index.html" 222ACCESSKEY="H" 223>Home</A 224></TD 225><TD 226WIDTH="33%" 227ALIGN="right" 228VALIGN="top" 229><A 230HREF="sdlcdnumdrives.html" 231ACCESSKEY="N" 232>Next</A 233></TD 234></TR 235><TR 236><TD 237WIDTH="33%" 238ALIGN="left" 239VALIGN="top" 240>SDL_CloseAudio</TD 241><TD 242WIDTH="34%" 243ALIGN="center" 244VALIGN="top" 245><A 246HREF="reference.html" 247ACCESSKEY="U" 248>Up</A 249></TD 250><TD 251WIDTH="33%" 252ALIGN="right" 253VALIGN="top" 254>SDL_CDNumDrives</TD 255></TR 256></TABLE 257></DIV 258></BODY 259></HTML 260>