SDL-1.2.14
[sdl_omap.git] / docs / html / sdlcdstatus.html
CommitLineData
e14743d1 1<HTML
2><HEAD
3><TITLE
4>SDL_CDStatus</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="CD-ROM"
14HREF="cdrom.html"><LINK
15REL="PREVIOUS"
16TITLE="SDL_CDOpen"
17HREF="sdlcdopen.html"><LINK
18REL="NEXT"
19TITLE="SDL_CDPlay"
20HREF="sdlcdplay.html"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFF8DC"
24TEXT="#000000"
25LINK="#0000ee"
26VLINK="#551a8b"
27ALINK="#ff0000"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>SDL Library Documentation</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="sdlcdopen.html"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="sdlcdplay.html"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="SDLCDSTATUS"
74></A
75>SDL_CDStatus</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN7308"
80></A
81><H2
82>Name</H2
83>SDL_CDStatus&nbsp;--&nbsp;Returns the current status of the given drive.</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN7311"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><A
94NAME="AEN7312"
95></A
96><P
97></P
98><PRE
99CLASS="FUNCSYNOPSISINFO"
100>#include "SDL.h"</PRE
101><P
102><CODE
103><CODE
104CLASS="FUNCDEF"
105>CDstatus <B
106CLASS="FSFUNC"
107>SDL_CDStatus</B
108></CODE
109>(SDL_CD *cdrom);</CODE
110></P
111><PRE
112CLASS="FUNCSYNOPSISINFO"
113>/* Given a status, returns true if there's a disk in the drive */
114#define CD_INDRIVE(status) ((int)status &#62; 0)</PRE
115><P
116></P
117></DIV
118></DIV
119><DIV
120CLASS="REFSECT1"
121><A
122NAME="AEN7319"
123></A
124><H2
125>Description</H2
126><P
127>This function returns the current status of the given drive. Status is described like so:
128<PRE
129CLASS="PROGRAMLISTING"
130>typedef enum {
131 CD_TRAYEMPTY,
132 CD_STOPPED,
133 CD_PLAYING,
134 CD_PAUSED,
135 CD_ERROR = -1
136} CDstatus;</PRE
137></P
138><P
139>If the drive has a CD in it, the table of contents of the CD and current
140play position of the CD will be stored in the SDL_CD structure.</P
141><P
142>The macro <TT
143CLASS="LITERAL"
144>CD_INDRIVE</TT
145> is provided for convenience,
146and given a status returns true if there's a disk in the drive.</P
147><DIV
148CLASS="NOTE"
149><BLOCKQUOTE
150CLASS="NOTE"
151><P
152><B
153>Note: </B
154><TT
155CLASS="FUNCTION"
156>SDL_CDStatus</TT
157> also updates the <A
158HREF="sdlcd.html"
159><SPAN
160CLASS="STRUCTNAME"
161>SDL_CD</SPAN
162></A
163> structure passed to it.</P
164></BLOCKQUOTE
165></DIV
166></DIV
167><DIV
168CLASS="REFSECT1"
169><A
170NAME="AEN7331"
171></A
172><H2
173>Example</H2
174><PRE
175CLASS="PROGRAMLISTING"
176>int playTrack(int track)
177{
178 int playing = 0;
179
180 if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
181 /* clamp to the actual number of tracks on the CD */
182 if (track &#62;= cdrom-&#62;numtracks) {
183 track = cdrom-&#62;numtracks-1;
184 }
185
186 if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
187 playing = 1;
188 }
189 }
190 return playing;
191}</PRE
192></DIV
193><DIV
194CLASS="REFSECT1"
195><A
196NAME="AEN7334"
197></A
198><H2
199>See Also</H2
200><P
201><A
202HREF="sdlcd.html"
203><TT
204CLASS="FUNCTION"
205>SDL_CD</TT
206></A
207></P
208></DIV
209><DIV
210CLASS="NAVFOOTER"
211><HR
212ALIGN="LEFT"
213WIDTH="100%"><TABLE
214SUMMARY="Footer navigation table"
215WIDTH="100%"
216BORDER="0"
217CELLPADDING="0"
218CELLSPACING="0"
219><TR
220><TD
221WIDTH="33%"
222ALIGN="left"
223VALIGN="top"
224><A
225HREF="sdlcdopen.html"
226ACCESSKEY="P"
227>Prev</A
228></TD
229><TD
230WIDTH="34%"
231ALIGN="center"
232VALIGN="top"
233><A
234HREF="index.html"
235ACCESSKEY="H"
236>Home</A
237></TD
238><TD
239WIDTH="33%"
240ALIGN="right"
241VALIGN="top"
242><A
243HREF="sdlcdplay.html"
244ACCESSKEY="N"
245>Next</A
246></TD
247></TR
248><TR
249><TD
250WIDTH="33%"
251ALIGN="left"
252VALIGN="top"
253>SDL_CDOpen</TD
254><TD
255WIDTH="34%"
256ALIGN="center"
257VALIGN="top"
258><A
259HREF="cdrom.html"
260ACCESSKEY="U"
261>Up</A
262></TD
263><TD
264WIDTH="33%"
265ALIGN="right"
266VALIGN="top"
267>SDL_CDPlay</TD
268></TR
269></TABLE
270></DIV
271></BODY
272></HTML
273>