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