3
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
6
<table cellspacing=3 width=100%><tr><td bgcolor=#00000>
7
<table width=100%><tr><td bgcolor=c2fc20 align=center>
8
<a href=http://www.pygame.org>
9
<img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
10
<b>pygame documentation</b>
11
</td><td bgcolor=6aee28 align=center valign=top width=100%>
14
<a href=http://www.pygame.org>Home</a> ||
15
<a href=../index.html>Help Contents</a> ||
18
|| <a href=pygame.html>pygame</a> ||
19
<a href=pygame_cdrom.html>cdrom</a> ||
20
<a href=pygame_constants.html>constants</a> ||
21
<a href=pygame_display.html>display</a> ||
22
<a href=pygame_draw.html>draw</a> ||
23
<a href=pygame_event.html>event</a> ||<br>
24
|| <a href=pygame_font.html>font</a> ||
25
<a href=pygame_image.html>image</a> ||
26
<a href=pygame_joystick.html>joystick</a> ||
27
<a href=pygame_key.html>key</a> ||
28
<a href=pygame_mixer.html>mixer</a> ||
29
<a href=pygame_mixer_music.html>mixer_music</a> ||<br>
30
|| <a href=pygame_mouse.html>mouse</a> ||
31
<a href=pygame_movie.html>movie</a> ||
32
<a href=pygame_surfarray.html>surfarray</a> ||
33
<a href=pygame_time.html>time</a> ||
34
<a href=pygame_transform.html>transform</a> ||<br>
35
<br>|| <a href=CD.html>CD</a> ||
36
<a href=Channel.html>Channel</a> ||
37
<a href=Clock.html>Clock</a> ||
38
<a href=Font.html>Font</a> ||
39
<a href=Joystick.html>Joystick</a> ||
40
<a href=Movie.html>Movie</a> ||<br>
41
|| <a href=Rect.html>Rect</a> ||
42
<a href=Sound.html>Sound</a> ||
43
<a href=Surface.html>Surface</a> ||<br>
44
<br>|| <a href=pygame_cursors.html>cursors</a> ||
45
<a href=pygame_sprite.html>sprite</a> ||
46
<a href=pygame_version.html>version</a> ||<br>
49
</td></tr></table></td></tr></table>
51
<h2 align=center>CD</h2>
52
The CD object represents a CDROM drive and allows you to
53
access the CD inside that drive. All functions (except <a href=#get_name>get_name()</a> and <a href=#get_id>get_id()</a>)
54
require the CD object to be initialized. This is done with the
55
<a href=#init>CD.init()</a> function.
57
Be sure to understand there is a difference between the cdrom module
63
<tr><td><a href=#eject>eject</a></td><td> -
64
ejects cdrom drive</td></tr>
67
<tr><td><a href=#get_all>get_all</a></td><td> -
68
get all track information for the cd</td></tr>
71
<tr><td><a href=#get_busy>get_busy</a></td><td> -
72
checks if the cd is currently playing</td></tr>
75
<tr><td><a href=#get_current>get_current</a></td><td> -
76
get current position of the cdrom</td></tr>
79
<tr><td><a href=#get_empty>get_empty</a></td><td> -
80
checks for a cd in the drive</td></tr>
83
<tr><td><a href=#get_id>get_id</a></td><td> -
84
get device id number for drive</td></tr>
87
<tr><td><a href=#get_init>get_init</a></td><td> -
88
check if cd is initialized</td></tr>
91
<tr><td><a href=#get_name>get_name</a></td><td> -
92
query name of cdrom drive</td></tr>
95
<tr><td><a href=#get_numtracks>get_numtracks</a></td><td> -
96
get number of tracks on cd</td></tr>
99
<tr><td><a href=#get_paused>get_paused</a></td><td> -
100
checks if the cd is currently paused</td></tr>
103
<tr><td><a href=#get_track_audio>get_track_audio</a></td><td> -
104
check if a track has audio data</td></tr>
107
<tr><td><a href=#get_track_length>get_track_length</a></td><td> -
108
check the length of an audio track</td></tr>
111
<tr><td><a href=#get_track_start>get_track_start</a></td><td> -
112
check the start of an audio track</td></tr>
115
<tr><td><a href=#init>init</a></td><td> -
116
initialize a cdrom device for use</td></tr>
119
<tr><td><a href=#pause>pause</a></td><td> -
120
pause playing cdrom</td></tr>
123
<tr><td><a href=#play>play</a></td><td> -
124
play music from cdrom</td></tr>
127
<tr><td><a href=#quit>quit</a></td><td> -
128
uninitialize a cdrom device for use</td></tr>
131
<tr><td><a href=#resume>resume</a></td><td> -
132
resume paused cdrom</td></tr>
135
<tr><td><a href=#stop>stop</a></td><td> -
136
stops playing cdrom</td></tr>
143
<a name=eject><font size=+2><b>eject
144
</b></font><br><font size=+1><tt>
147
Ejects the media from the CDROM drive. If the drive is empty, this
148
will open the CDROM drive.
151
<a name=get_all><font size=+2><b>get_all
152
</b></font><br><font size=+1><tt>
153
CD.get_all() -> tuple
155
Returns a tuple with values for each track on the CD.
156
Each item in the tuple is a tuple with 4 values for each
157
track. First is a boolean set to true if this is an audio
158
track. The next 3 values are the start time, end time, and
162
<a name=get_busy><font size=+2><b>get_busy
163
</b></font><br><font size=+1><tt>
164
CD.get_busy() -> bool
166
Returns a true value if the cd drive is currently playing. If
167
the drive is paused, this will return false.
170
<a name=get_current><font size=+2><b>get_current
171
</b></font><br><font size=+1><tt>
172
CD.get_current() -> track, seconds
174
Returns the current track on the cdrom and the number of
175
seconds into that track.
178
<a name=get_empty><font size=+2><b>get_empty
179
</b></font><br><font size=+1><tt>
180
CD.get_empty() -> bool
182
Returns a true value if the cd drive is empty.
185
<a name=get_id><font size=+2><b>get_id
186
</b></font><br><font size=+1><tt>
189
Returns the device id number for this cdrom drive. This is the
190
same number used in the call to <a href=pygame_cdrom.html#CD>pygame.cdrom.CD()</a> to create this
191
cd device. The CD object does not need to be initialized for this
195
<a name=get_init><font size=+2><b>get_init
196
</b></font><br><font size=+1><tt>
197
CD.get_init() -> bool
199
Returns a true value if the CD is initialized.
202
<a name=get_name><font size=+2><b>get_name
203
</b></font><br><font size=+1><tt>
204
CD.get_name(id) -> string
206
Returns the name of the CDROM device, given by the
207
system. This function can be called before the drive
211
<a name=get_numtracks><font size=+2><b>get_numtracks
212
</b></font><br><font size=+1><tt>
213
CD.get_numtracks() -> numtracks
215
Returns the number of available tracks on the CD. Note that not
216
all of these tracks contain audio data. Use <a href=#get_track_audio>CD.get_track_audio()</a> to check
217
the track type before playing.
220
<a name=get_paused><font size=+2><b>get_paused
221
</b></font><br><font size=+1><tt>
222
CD.get_paused() -> bool
224
Returns a true value if the cd drive is currently paused.
227
<a name=get_track_audio><font size=+2><b>get_track_audio
228
</b></font><br><font size=+1><tt>
229
CD.get_track_audio(track) -> bool
231
Returns true if the cdrom track contains audio data.
234
<a name=get_track_length><font size=+2><b>get_track_length
235
</b></font><br><font size=+1><tt>
236
CD.get_track_length(track) -> seconds
238
Returns the number of seconds in an audio track. If the
239
track does not contain audio data, returns 0.0.
242
<a name=get_track_start><font size=+2><b>get_track_start
243
</b></font><br><font size=+1><tt>
244
CD.get_track_start(track) -> seconds
246
Returns the number of seconds an audio track starts
250
<a name=init><font size=+2><b>init
251
</b></font><br><font size=+1><tt>
254
In order to call most members in the CD object, the
255
CD must be initialized. You can initialzie the CD object
256
at anytime, and it is ok to initialize more than once.
259
<a name=pause><font size=+2><b>pause
260
</b></font><br><font size=+1><tt>
263
Pauses the playing CD. If the CD is not playing, this will
267
<a name=play><font size=+2><b>play
268
</b></font><br><font size=+1><tt>
269
CD.play(track, [start, end]) -> None
271
Play an audio track on a cdrom disk.
272
You may also optionally pass a starting and ending
273
time to play of the song. If you pass the start end
274
end time in seconds, only that portion of the audio
278
<a name=quit><font size=+2><b>quit
279
</b></font><br><font size=+1><tt>
282
After you are completely finished with a cdrom device, you
283
can use this <a href=pygame.html#quit>quit()</a> function to free access to the drive.
284
This will be cleaned up automatically when the cdrom module is.
285
uninitialized. It is safe to call this function on an uninitialized CD.
288
<a name=resume><font size=+2><b>resume
289
</b></font><br><font size=+1><tt>
292
Resumes playback of a paused CD. If the CD has not been
293
pause, this will do nothing.
296
<a name=stop><font size=+2><b>stop
297
</b></font><br><font size=+1><tt>
300
Stops the playing CD. If the CD is not playing, this will