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