1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
|
<html>
<title>cdrom - Pygame Documentation</title>
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
<table cellpadding=0 cellspacing=0 border=0 style='border: 3px solid black;' width='100%'>
<tr>
<td bgcolor='#c2fc20' style='padding: 6px;' align=center valign=center><a href='http://www.pygame.org/'><img src='../pygame_tiny.gif' border=0 width=200 height=60></a><br><b>pygame documentation</b></td>
<td bgcolor='#6aee28' style='border-left: 3px solid black; padding: 6px;' align=center valign=center>
||
<a href=http://www.pygame.org>Pygame Home</a> ||
<a href=../index.html>Help Contents</a> ||
<a href=index.html>Reference Index</a> ||
<br> <br>
<a href="camera.html">Camera</a> ||
<a href="cdrom.html">Cdrom</a> ||
<a href="color.html">Color</a> ||
<a href="cursors.html">Cursors</a> ||
<a href="display.html">Display</a> ||
<a href="draw.html">Draw</a> ||
<a href="event.html">Event</a> ||
<a href="examples.html">Examples</a> ||
<a href="font.html">Font</a> ||
<a href="gfxdraw.html">Gfxdraw</a> ||
<a href="image.html">Image</a> ||
<a href="joystick.html">Joystick</a> ||
<a href="key.html">Key</a> ||
<a href="locals.html">Locals</a> ||
<a href="mask.html">Mask</a> ||
<a href="midi.html">Midi</a> ||
<a href="mixer.html">Mixer</a> ||
<a href="mouse.html">Mouse</a> ||
<a href="movie.html">Movie</a> ||
<a href="music.html">Music</a> ||
<a href="overlay.html">Overlay</a> ||
<a href="pixelarray.html">Pixelarray</a> ||
<a href="pygame.html">Pygame</a> ||
<a href="rect.html">Rect</a> ||
<a href="scrap.html">Scrap</a> ||
<a href="sndarray.html">Sndarray</a> ||
<a href="sprite.html">Sprite</a> ||
<a href="surface.html">Surface</a> ||
<a href="surfarray.html">Surfarray</a> ||
<a href="tests.html">Tests</a> ||
<a href="time.html">Time</a> ||
<a href="transform.html">Transform</a>
</td></tr></table>
<br>
<a name="pygame.cdrom">
<big><b>pygame.cdrom</big></b><br><ul>
<i>pygame module for audio cdrom control</i><br>
<ul><small><table>
<tr><td><a href="cdrom.html#pygame.cdrom.init">pygame.cdrom.init</a> - <font size=-1>initialize the cdrom module</font></td><td>initialize the cdrom module</td></tr>
<tr><td><a href="cdrom.html#pygame.cdrom.quit">pygame.cdrom.quit</a> - <font size=-1>uninitialize the cdrom module</font></td><td>uninitialize the cdrom module</td></tr>
<tr><td><a href="cdrom.html#pygame.cdrom.get_init">pygame.cdrom.get_init</a> - <font size=-1>true if the cdrom module is initialized</font></td><td>true if the cdrom module is initialized</td></tr>
<tr><td><a href="cdrom.html#pygame.cdrom.get_count">pygame.cdrom.get_count</a> - <font size=-1>number of cd drives on the system</font></td><td>number of cd drives on the system</td></tr>
<tr><td><a href="cdrom.html#pygame.cdrom.CD">pygame.cdrom.CD</a> - <font size=-1>class to manage a cdrom drive</font></td><td>class to manage a cdrom drive</td></tr>
</table></small></ul>
<p>The cdrom module manages the <tt>CD</tt> and <tt>DVD</tt> drives on a computer. It can also control the playback of audio cd's. This module needs to be initialized before it can do anything. Each <tt>CD</tt> object you create represents a cdrom drive and must also be initialized individually before it can do most things. </p>
<!--COMMENTS:pygame.cdrom--> <br>
<a name="pygame.cdrom.init">
<big><b>pygame.cdrom.init</big></b><br><ul>
<i>initialize the cdrom module</i><br>
<tt>pygame.cdrom.init(): return None</tt><br>
<p>Initialize the cdrom module. This will scan the system for all <tt>CD</tt> devices. The module must be initialized before any other functions will work. This automatically happens when you call <tt><a href="pygame.html#pygame.init">pygame.init</a> - <font size=-1>initialize all imported pygame modules</font></tt>. </p>
<p>It is safe to call this function more than once. </p>
<!--COMMENTS:pygame.cdrom.init--> <br>
<br></ul>
<a name="pygame.cdrom.quit">
<big><b>pygame.cdrom.quit</big></b><br><ul>
<i>uninitialize the cdrom module</i><br>
<tt>pygame.cdrom.quit(): return None</tt><br>
<p>Uninitialize the cdrom module. After you call this any existing <tt>CD</tt> objects will no longer work. </p>
<p>It is safe to call this function more than once. </p>
<!--COMMENTS:pygame.cdrom.quit--> <br>
<br></ul>
<a name="pygame.cdrom.get_init">
<big><b>pygame.cdrom.get_init</big></b><br><ul>
<i>true if the cdrom module is initialized</i><br>
<tt>pygame.cdrom.get_init(): return bool</tt><br>
<p>Test if the cdrom module is initialized or not. This is different than the <tt><a href="cdrom.html#CD.init">CD.init</a> - <font size=-1>initialize a cdrom drive for use</font></tt> since each drive must also be initialized individually. </p>
<!--COMMENTS:pygame.cdrom.get_init--> <br>
<br></ul>
<a name="pygame.cdrom.get_count">
<big><b>pygame.cdrom.get_count</big></b><br><ul>
<i>number of cd drives on the system</i><br>
<tt>pygame.cdrom.get_count(): return count</tt><br>
<p>Return the number of cd drives on the system. When you create <tt>CD</tt> objects you need to pass an integer id that must be lower than this count. The count will be 0 if there are no drives on the system. </p>
<!--COMMENTS:pygame.cdrom.get_count--> <br>
<br></ul>
<a name="pygame.cdrom.CD">
<big><b>pygame.cdrom.CD</big></b><br><ul>
<i>class to manage a cdrom drive</i><br>
<tt>pygame.cdrom.CD(id): return CD</tt><br>
<ul><small><table>
<tr><td><a href="cdrom.html#CD.init">CD.init</a> - <font size=-1>initialize a cdrom drive for use</font></td><td>initialize a cdrom drive for use</td></tr>
<tr><td><a href="cdrom.html#CD.quit">CD.quit</a> - <font size=-1>uninitialize a cdrom drive for use</font></td><td>uninitialize a cdrom drive for use</td></tr>
<tr><td><a href="cdrom.html#CD.get_init">CD.get_init</a> - <font size=-1>true if this cd device initialized</font></td><td>true if this cd device initialized</td></tr>
<tr><td><a href="cdrom.html#CD.play">CD.play</a> - <font size=-1>start playing audio</font></td><td>start playing audio</td></tr>
<tr><td><a href="cdrom.html#CD.stop">CD.stop</a> - <font size=-1>stop audio playback</font></td><td>stop audio playback</td></tr>
<tr><td><a href="cdrom.html#CD.pause">CD.pause</a> - <font size=-1>temporarily stop audio playback</font></td><td>temporarily stop audio playback</td></tr>
<tr><td><a href="cdrom.html#CD.resume">CD.resume</a> - <font size=-1>unpause audio playback</font></td><td>unpause audio playback</td></tr>
<tr><td><a href="cdrom.html#CD.eject">CD.eject</a> - <font size=-1>eject or open the cdrom drive</font></td><td>eject or open the cdrom drive</td></tr>
<tr><td><a href="cdrom.html#CD.get_id">CD.get_id</a> - <font size=-1>the index of the cdrom drive</font></td><td>the index of the cdrom drive</td></tr>
<tr><td><a href="cdrom.html#CD.get_name">CD.get_name</a> - <font size=-1>the system name of the cdrom drive</font></td><td>the system name of the cdrom drive</td></tr>
<tr><td><a href="cdrom.html#CD.get_busy">CD.get_busy</a> - <font size=-1>true if the drive is playing audio</font></td><td>true if the drive is playing audio</td></tr>
<tr><td><a href="cdrom.html#CD.get_paused">CD.get_paused</a> - <font size=-1>true if the drive is paused</font></td><td>true if the drive is paused</td></tr>
<tr><td><a href="cdrom.html#CD.get_current">CD.get_current</a> - <font size=-1>the current audio playback position</font></td><td>the current audio playback position</td></tr>
<tr><td><a href="cdrom.html#CD.get_empty">CD.get_empty</a> - <font size=-1>False if a cdrom is in the drive</font></td><td>False if a cdrom is in the drive</td></tr>
<tr><td><a href="cdrom.html#CD.get_numtracks">CD.get_numtracks</a> - <font size=-1>the number of tracks on the cdrom</font></td><td>the number of tracks on the cdrom</td></tr>
<tr><td><a href="cdrom.html#CD.get_track_audio">CD.get_track_audio</a> - <font size=-1>true if the cdrom track has audio data</font></td><td>true if the cdrom track has audio data</td></tr>
<tr><td><a href="cdrom.html#CD.get_all">CD.get_all</a> - <font size=-1>get all track information</font></td><td>get all track information</td></tr>
<tr><td><a href="cdrom.html#CD.get_track_start">CD.get_track_start</a> - <font size=-1>start time of a cdrom track</font></td><td>start time of a cdrom track</td></tr>
<tr><td><a href="cdrom.html#CD.get_track_length">CD.get_track_length</a> - <font size=-1>length of a cdrom track</font></td><td>length of a cdrom track</td></tr>
</table></small></ul>
<p>You can create a <tt>CD</tt> object for each cdrom on the system. Use <tt><a href="cdrom.html#pygame.cdrom.get_count">pygame.cdrom.get_count</a> - <font size=-1>number of cd drives on the system</font></tt> to determine how many drives actually exist. The id argument is an integer of the drive, starting at zero. </p>
<p>The <tt>CD</tt> object is not initialized, you can only call <tt><a href="cdrom.html#CD.get_id">CD.get_id</a> - <font size=-1>the index of the cdrom drive</font></tt> and <tt><a href="cdrom.html#CD.get_name">CD.get_name</a> - <font size=-1>the system name of the cdrom drive</font></tt> on an uninitialized drive. </p>
<p>It is safe to create multiple <tt>CD</tt> objects for the same drive, they will all cooperate normally. </p>
<!--COMMENTS:pygame.cdrom.CD--> <br>
<a name="CD.init">
<big><b>CD.init</big></b><br><ul>
<i>initialize a cdrom drive for use</i><br>
<tt>CD.init(): return None</tt><br>
<p>Initialize the cdrom drive for use. The drive must be initialized for most <tt>CD</tt> methods to work. Even if the rest of pygame has been initialized. </p>
<p>There may be a brief pause while the drive is initialized. Avoid <tt><a href="cdrom.html#CD.init">CD.init</a> - <font size=-1>initialize a cdrom drive for use</font></tt> if the program should not stop for a second or two. </p>
<!--COMMENTS:CD.init--> <br>
<br></ul>
<a name="CD.quit">
<big><b>CD.quit</big></b><br><ul>
<i>uninitialize a cdrom drive for use</i><br>
<tt>CD.quit(): return None</tt><br>
<p>Uninitialize a drive for use. Call this when your program will not be accessing the drive for awhile. </p>
<!--COMMENTS:CD.quit--> <br>
<br></ul>
<a name="CD.get_init">
<big><b>CD.get_init</big></b><br><ul>
<i>true if this cd device initialized</i><br>
<tt>CD.get_init(): return bool</tt><br>
<p>Test if this <tt>CDROM</tt> device is initialized. This is different than the <tt><a href="cdrom.html#pygame.cdrom.init">pygame.cdrom.init</a> - <font size=-1>initialize the cdrom module</font></tt> since each drive must also be initialized individually. </p>
<!--COMMENTS:CD.get_init--> <br>
<br></ul>
<a name="CD.play">
<big><b>CD.play</big></b><br><ul>
<i>start playing audio</i><br>
<tt>CD.play(track, start=None, end=None): return None</tt><br>
<p>Playback audio from an audio cdrom in the drive. Besides the track number argument, you can also pass a starting and ending time for playback. The start and end time are in seconds, and can limit the section of an audio track played. </p>
<p>If you pass a start time but no end, the audio will play to the end of the track. If you pass a start time and 'None' for the end time, the audio will play to the end of the entire disc. </p>
<p>See the <tt><a href="cdrom.html#CD.get_numtracks">CD.get_numtracks</a> - <font size=-1>the number of tracks on the cdrom</font></tt> and <tt><a href="cdrom.html#CD.get_track_audio">CD.get_track_audio</a> - <font size=-1>true if the cdrom track has audio data</font></tt> to find tracks to playback. </p>
<p>Note, track 0 is the first track on the <tt>CD</tt>. Track numbers start at zero. </p>
<!--COMMENTS:CD.play--> <br>
<br></ul>
<a name="CD.stop">
<big><b>CD.stop</big></b><br><ul>
<i>stop audio playback</i><br>
<tt>CD.stop(): return None</tt><br>
<p>Stops playback of audio from the cdrom. This will also lose the current playback position. This method does nothing if the drive isn't already playing audio. </p>
<!--COMMENTS:CD.stop--> <br>
<br></ul>
<a name="CD.pause">
<big><b>CD.pause</big></b><br><ul>
<i>temporarily stop audio playback</i><br>
<tt>CD.pause(): return None</tt><br>
<p>Temporarily stop audio playback on the <tt>CD</tt>. The playback can be resumed at the same point with the <tt><a href="cdrom.html#CD.resume">CD.resume</a> - <font size=-1>unpause audio playback</font></tt> method. If the <tt>CD</tt> is not playing this method does nothing. </p>
<p>Note, track 0 is the first track on the <tt>CD</tt>. Track numbers start at zero. </p>
<!--COMMENTS:CD.pause--> <br>
<br></ul>
<a name="CD.resume">
<big><b>CD.resume</big></b><br><ul>
<i>unpause audio playback</i><br>
<tt>CD.resume(): return None</tt><br>
<p>Unpause a paused <tt>CD</tt>. If the <tt>CD</tt> is not paused or already playing, this method does nothing. </p>
<!--COMMENTS:CD.resume--> <br>
<br></ul>
<a name="CD.eject">
<big><b>CD.eject</big></b><br><ul>
<i>eject or open the cdrom drive</i><br>
<tt>CD.eject(): return None</tt><br>
<p>This will open the cdrom drive and eject the cdrom. If the drive is playing or paused it will be stopped. </p>
<!--COMMENTS:CD.eject--> <br>
<br></ul>
<a name="CD.get_id">
<big><b>CD.get_id</big></b><br><ul>
<i>the index of the cdrom drive</i><br>
<tt>CD.get_id(): return id</tt><br>
<p>Returns the integer id that was used to create the <tt>CD</tt> instance. This method can work on an uninitialized <tt>CD</tt>. </p>
<!--COMMENTS:CD.get_id--> <br>
<br></ul>
<a name="CD.get_name">
<big><b>CD.get_name</big></b><br><ul>
<i>the system name of the cdrom drive</i><br>
<tt>CD.get_name(): return name</tt><br>
<p>Return the string name of the drive. This is the system name used to represent the drive. It is often the drive letter or device name. This method can work on an uninitialized <tt>CD</tt>. </p>
<!--COMMENTS:CD.get_name--> <br>
<br></ul>
<a name="CD.get_busy">
<big><b>CD.get_busy</big></b><br><ul>
<i>true if the drive is playing audio</i><br>
<tt>CD.get_busy(): return bool</tt><br>
<p>Returns True if the drive busy playing back audio. </p>
<!--COMMENTS:CD.get_busy--> <br>
<br></ul>
<a name="CD.get_paused">
<big><b>CD.get_paused</big></b><br><ul>
<i>true if the drive is paused</i><br>
<tt>CD.get_paused(): return bool</tt><br>
<p>Returns True if the drive is currently paused. </p>
<!--COMMENTS:CD.get_paused--> <br>
<br></ul>
<a name="CD.get_current">
<big><b>CD.get_current</big></b><br><ul>
<i>the current audio playback position</i><br>
<tt>CD.get_current(): return track, seconds</tt><br>
<p>Returns both the current track and time of that track. This method works when the drive is either playing or paused. </p>
<p>Note, track 0 is the first track on the <tt>CD</tt>. Track numbers start at zero. </p>
<!--COMMENTS:CD.get_current--> <br>
<br></ul>
<a name="CD.get_empty">
<big><b>CD.get_empty</big></b><br><ul>
<i>False if a cdrom is in the drive</i><br>
<tt>CD.get_empty(): return bool</tt><br>
<p>Return False if there is a cdrom currently in the drive. If the drive is empty this will return True. </p>
<!--COMMENTS:CD.get_empty--> <br>
<br></ul>
<a name="CD.get_numtracks">
<big><b>CD.get_numtracks</big></b><br><ul>
<i>the number of tracks on the cdrom</i><br>
<tt>CD.get_numtracks(): return count</tt><br>
<p>Return the number of tracks on the cdrom in the drive. This will return zero of the drive is empty or has no tracks. </p>
<!--COMMENTS:CD.get_numtracks--> <br>
<br></ul>
<a name="CD.get_track_audio">
<big><b>CD.get_track_audio</big></b><br><ul>
<i>true if the cdrom track has audio data</i><br>
<tt>CD.get_track_audio(track): return bool</tt><br>
<p>Determine if a track on a cdrom contains audio data. You can also call <tt>CD.num_tracks()</tt> and <tt><a href="cdrom.html#CD.get_all">CD.get_all</a> - <font size=-1>get all track information</font></tt> to determine more information about the cdrom. </p>
<p>Note, track 0 is the first track on the <tt>CD</tt>. Track numbers start at zero. </p>
<!--COMMENTS:CD.get_track_audio--> <br>
<br></ul>
<a name="CD.get_all">
<big><b>CD.get_all</big></b><br><ul>
<i>get all track information</i><br>
<tt>CD.get_all(): return [(audio, start, end, lenth), ...]</tt><br>
<p>Return a list with information for every track on the cdrom. The information consists of a tuple with four values. The audio value is True if the track contains audio data. The start, end, and length values are floating point numbers in seconds. Start and end represent absolute times on the entire disc. </p>
<!--COMMENTS:CD.get_all--> <br>
<br></ul>
<a name="CD.get_track_start">
<big><b>CD.get_track_start</big></b><br><ul>
<i>start time of a cdrom track</i><br>
<tt>CD.get_track_start(track): return seconds</tt><br>
<p>Return the absolute time in seconds where at start of the cdrom track. </p>
<p>Note, track 0 is the first track on the <tt>CD</tt>. Track numbers start at zero. </p>
<!--COMMENTS:CD.get_track_start--> <br>
<br></ul>
<a name="CD.get_track_length">
<big><b>CD.get_track_length</big></b><br><ul>
<i>length of a cdrom track</i><br>
<tt>CD.get_track_length(track): return seconds</tt><br>
<p>Return a floating point value in seconds of the length of the cdrom track. </p>
<p>Note, track 0 is the first track on the <tt>CD</tt>. Track numbers start at zero. </p>
<!--COMMENTS:CD.get_track_length--> <br>
<br></ul>
<br></ul>
<br></ul>
</body></html>
|