updated docs
[sdlgit/SDL-Site.git] / pages / SDL-CD.html-inc
1 <div class="pod">
2 <!-- INDEX START -->
3 <h3 id="TOP">Index</h3>
4
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8 <li><a href="#CONSTANTS">CONSTANTS</a></li>
9 <li><a href="#METHOD">METHOD</a>
10 <ul><li><a href="#new">new</a></li>
11 <li><a href="#status">status</a></li>
12 <li><a href="#play_tracks">play_tracks</a></li>
13 <li><a href="#play">play</a></li>
14 <li><a href="#pause">pause </a></li>
15 <li><a href="#resume">resume</a></li>
16 <li><a href="#stop">stop</a></li>
17 <li><a href="#eject">eject</a></li>
18 <li><a href="#id">id</a></li>
19 <li><a href="#num_tracks">num_tracks</a></li>
20 <li><a href="#cur_track">cur_track </a></li>
21 <li><a href="#track">track</a></li>
22 <li><a href="#FRAMES_TO_MSF">FRAMES_TO_MSF</a></li>
23 <li><a href="#MSF_TO_FRAMES">MSF_TO_FRAMES</a></li>
24 </ul>
25 </li>
26 <li><a href="#SEE_ALSO">SEE ALSO</a></li>
27 <li><a href="#AUTHORS">AUTHORS</a>
28 </li>
29 </ul><hr />
30 <!-- INDEX END -->
31
32 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
33 <div id="NAME_CONTENT">
34 <p>SDL::CD -- SDL Bindings for structure SDL_CD</p>
35
36 </div>
37 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
38 <div id="CATEGORY_CONTENT">
39 <p>Core, CDROM, Structure</p>
40
41 </div>
42 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
43 <div id="SYNOPSIS_CONTENT">
44 <pre> use SDL;
45  use SDL::CDROM;
46  use SDL::CD;
47
48  SDL::init(SDL_INIT_CDROM);
49
50  my $drives = SDL::CDROM::num_drives;
51
52  if( $drives &gt; 0 )
53  {
54   my $CD = SDL::CD-&gt;new( 0 );
55
56    if($CD)
57    {
58         ... 
59    }
60
61  }
62
63 </pre>
64
65 </div>
66 <h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
67 <div id="CONSTANTS_CONTENT">
68 <p>The constants are exported by default. You can avoid this by doing:</p>
69 <pre> use SDL::CD ();
70
71 </pre>
72 <p>and access them directly:</p>
73 <pre> SDL::CD::CD_TRAYEMPTY;
74
75 </pre>
76 <p>or by choosing the export tags below:</p>
77 <p>Export tag: ':status'</p>
78 <pre> CD_TRAYEMPTY
79  CD_STOPPED
80  CD_PLAYING
81  CD_PAUSED
82  CD_ERROR
83
84 </pre>
85 <p>Export tag: ':defaults'</p>
86 <pre> CD_FPS
87  SDL_MAX_TRACKS
88
89 </pre>
90
91 </div>
92 <h1 id="METHOD">METHOD</h1><p><a href="#TOP" class="toplink">Top</a></p>
93 <div id="METHOD_CONTENT">
94
95 </div>
96 <h2 id="new">new</h2>
97 <div id="new_CONTENT">
98 <pre> my $CD = SDL::CD-&gt;new($drive)
99
100 </pre>
101 <p>Makes a new SDL::CD object. Returns <code>undef</code> if the drive is busy or inaccessible. </p>
102
103 </div>
104 <h2 id="status">status</h2>
105 <div id="status_CONTENT">
106 <pre> my $status = $CD-&gt;status(); 
107
108 </pre>
109 <p>Returns the current status of the CD tray </p>
110 <p>Returns on of the following constants:</p>
111 <ul>
112                 <li>CD_TRAYEMPTY        </li>
113                 <li>CD_STOPPED  </li>
114                 <li>CD_PLAYING  </li>
115                 <li>CD_PAUSED   </li>
116                 <li>CD_ERROR</li>
117 </ul>
118
119
120 </div>
121 <h2 id="play_tracks">play_tracks</h2>
122 <div id="play_tracks_CONTENT">
123 <pre> $CD-&gt;play_tracks($start_track, $start_frame, $ntracks, $nframes)
124
125 </pre>
126 <p>Plays the given SDL::CD starting at track $start_track, for $ntracks tracks.  </p>
127 <p>$start_frame is the frame offset, from the beginning of the $start_track, at which to start. $nframes is the frame offset, from the 
128 beginning of the last track ($start_track+$ntracks), at which to end playing.</p>
129 <p>play_tracks() should only be called after calling <a href="#status">status</a> to get information about the CD.</p>
130 <p><strong>Note: Data tracks are ignored.</strong></p>
131 <p>Returns <code>0</code>, or <code>-1</code> if there was an error.  </p>
132
133 </div>
134 <h2 id="play">play</h2>
135 <div id="play_CONTENT">
136 <pre> $CD-&gt;play($start, $length);
137
138 </pre>
139 <p>Plays the given SDL::CD , starting a frame $start for $length frames. </p>
140 <p>Returns <code>0</code> on success, <code>-1</code> on error</p>
141
142 </div>
143 <h2 id="pause">pause </h2>
144 <div id="pause_CONTENT">
145 <pre> $CD-&gt;pause();
146
147 </pre>
148 <p>Pauses play on CD</p>
149 <p>Returns <code>0</code> on success, or <code>-1</code> on an error.  </p>
150
151 </div>
152 <h2 id="resume">resume</h2>
153 <div id="resume_CONTENT">
154 <pre> $CD-&gt;resume();
155
156 </pre>
157 <p>Returns <code>0</code> on success, or <code>-1</code> on an error.  </p>
158
159 </div>
160 <h2 id="stop">stop</h2>
161 <div id="stop_CONTENT">
162 <pre> $CD-&gt;stop();
163
164 </pre>
165 <p>Stops play on the CD.  </p>
166 <p>Returns <code>0</code> on success, or <code>-1</code> on an error.  </p>
167
168 </div>
169 <h2 id="eject">eject</h2>
170 <div id="eject_CONTENT">
171 <pre> $CD-&gt;eject();
172
173 </pre>
174 <p>Ejects the CD.</p>
175 <p>Returns <code>0</code> on success, or <code>-1</code> on an error.   </p>
176
177 </div>
178 <h2 id="id">id</h2>
179 <div id="id_CONTENT">
180 <pre> $CD-&gt;id();
181
182 </pre>
183 <p>Private drive identifier</p>
184
185 </div>
186 <h2 id="num_tracks">num_tracks</h2>
187 <div id="num_tracks_CONTENT">
188 <pre> $CD-&gt;num_tracks();
189
190 </pre>
191 <p>Number of tracks on the CD</p>
192
193 </div>
194 <h2 id="cur_track">cur_track </h2>
195 <div id="cur_track_CONTENT">
196 <pre> $CD-&gt;cur_track();
197
198 </pre>
199 <p>Current track on the CD;</p>
200
201 </div>
202 <h2 id="track">track</h2>
203 <div id="track_CONTENT">
204 <pre> my $track =  $CD-&gt;track($number);
205
206 </pre>
207 <p>Retrives track description of track $number in CD. See <a href="SDL-CDTrack.html">SDL::CDTrack</a>.</p>
208
209 </div>
210 <h2 id="FRAMES_TO_MSF">FRAMES_TO_MSF</h2>
211 <div id="FRAMES_TO_MSF_CONTENT">
212 <pre> my ($min, $sec, $fra) = FRAMES_TO_MSF($frames);
213
214 </pre>
215 <p>Conversion functions from frames to Minute/Second/Frames</p>
216
217 </div>
218 <h2 id="MSF_TO_FRAMES">MSF_TO_FRAMES</h2>
219 <div id="MSF_TO_FRAMES_CONTENT">
220 <pre> my $frames = MSF_TO_FRAMES($min, $sec, $fra);
221
222 </pre>
223
224 </div>
225 <h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
226 <div id="SEE_ALSO_CONTENT">
227 <p><a href="SDL-CDROM.html">SDL::CDROM</a>, <a href="SDL-CDTrack.html">SDL::CDTrack</a></p>
228
229 </div>
230 <h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
231 <div id="AUTHORS_CONTENT">
232 <p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
233
234 </div>
235 </div>