- 
pygame.cdrom
- pygame module for audio cdrom control— initialize the cdrom module — uninitialize the cdrom module — true if the cdrom module is initialized — number of cd drives on the system — class to manage a cdrom drive Warning This module is non functional in pygame 2.0 and above, unless you have manually compiled pygame with SDL1. This module will not be supported in the future. One alternative for python cdrom functionality is pycdio. The cdrom module manages the CDandDVDdrives on a computer. It can also control the playback of audio CDs. This module needs to be initialized before it can do anything. EachCDobject you create represents a cdrom drive and must also be initialized individually before it can do most things.- pygame.cdrom.init()¶
- initialize the cdrom moduleinit() -> NoneInitialize the cdrom module. This will scan the system for all CDdevices. The module must be initialized before any other functions will work. This automatically happens when you callpygame.init().It is safe to call this function more than once. 
 - pygame.cdrom.quit()¶
- uninitialize the cdrom modulequit() -> NoneUninitialize the cdrom module. After you call this any existing CDobjects will no longer work.It is safe to call this function more than once. 
 - pygame.cdrom.get_init()¶
- true if the cdrom module is initializedget_init() -> boolTest if the cdrom module is initialized or not. This is different than the CD.init()since each drive must also be initialized individually.
 - pygame.cdrom.get_count()¶
- number of cd drives on the systemget_count() -> countReturn the number of cd drives on the system. When you create CDobjects 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.
 - pygame.cdrom.CD¶
- class to manage a cdrom driveCD(id) -> CD— initialize a cdrom drive for use — uninitialize a cdrom drive for use — true if this cd device initialized — start playing audio — stop audio playback — temporarily stop audio playback — unpause audio playback — eject or open the cdrom drive — the index of the cdrom drive — the system name of the cdrom drive — true if the drive is playing audio — true if the drive is paused — the current audio playback position — False if a cdrom is in the drive — the number of tracks on the cdrom — true if the cdrom track has audio data — get all track information — start time of a cdrom track — length of a cdrom track You can create a CDobject for each cdrom on the system. Usepygame.cdrom.get_count()to determine how many drives actually exist. The id argument is an integer of the drive, starting at zero.The CDobject is not initialized, you can only callCD.get_id()andCD.get_name()on an uninitialized drive.It is safe to create multiple CDobjects for the same drive, they will all cooperate normally.- init()¶
- initialize a cdrom drive for useinit() -> NoneInitialize the cdrom drive for use. The drive must be initialized for most CDmethods to work. Even if the rest of pygame has been initialized.There may be a brief pause while the drive is initialized. Avoid CD.init()if the program should not stop for a second or two.
 - quit()¶
- uninitialize a cdrom drive for usequit() -> NoneUninitialize a drive for use. Call this when your program will not be accessing the drive for awhile. 
 - get_init()¶
- true if this cd device initializedget_init() -> boolTest if this CDROMdevice is initialized. This is different than thepygame.cdrom.init()since each drive must also be initialized individually.
 - play()¶
- start playing audioplay(track, start=None, end=None) -> NonePlayback 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. 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. See the CD.get_numtracks()andCD.get_track_audio()to find tracks to playback.Note, track 0 is the first track on the CD. Track numbers start at zero.
 - stop()¶
- stop audio playbackstop() -> NoneStops 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. 
 - pause()¶
- temporarily stop audio playbackpause() -> NoneTemporarily stop audio playback on the CD. The playback can be resumed at the same point with theCD.resume()method. If theCDis not playing this method does nothing.Note, track 0 is the first track on the CD. Track numbers start at zero.
 - resume()¶
- unpause audio playbackresume() -> NoneUnpause a paused CD. If theCDis not paused or already playing, this method does nothing.
 - eject()¶
- eject or open the cdrom driveeject() -> NoneThis will open the cdrom drive and eject the cdrom. If the drive is playing or paused it will be stopped. 
 - get_id()¶
- the index of the cdrom driveget_id() -> idReturns the integer id that was used to create the CDinstance. This method can work on an uninitializedCD.
 - get_name()¶
- the system name of the cdrom driveget_name() -> nameReturn 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 CD.
 - get_busy()¶
- true if the drive is playing audioget_busy() -> boolReturns True if the drive busy playing back audio. 
 - get_paused()¶
- true if the drive is pausedget_paused() -> boolReturns True if the drive is currently paused. 
 - get_current()¶
- the current audio playback positionget_current() -> track, secondsReturns both the current track and time of that track. This method works when the drive is either playing or paused. Note, track 0 is the first track on the CD. Track numbers start at zero.
 - get_empty()¶
- False if a cdrom is in the driveget_empty() -> boolReturn False if there is a cdrom currently in the drive. If the drive is empty this will return True. 
 - get_numtracks()¶
- the number of tracks on the cdromget_numtracks() -> countReturn the number of tracks on the cdrom in the drive. This will return zero of the drive is empty or has no tracks. 
 - get_track_audio()¶
- true if the cdrom track has audio dataget_track_audio(track) -> boolDetermine if a track on a cdrom contains audio data. You can also call CD.num_tracks()andCD.get_all()to determine more information about the cdrom.Note, track 0 is the first track on the CD. Track numbers start at zero.
 - get_all()¶
- get all track informationget_all() -> [(audio, start, end, length), ...]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. 
 - get_track_start()¶
- start time of a cdrom trackget_track_start(track) -> secondsReturn the absolute time in seconds where at start of the cdrom track. Note, track 0 is the first track on the CD. Track numbers start at zero.
 - get_track_length()¶
- length of a cdrom trackget_track_length(track) -> secondsReturn a floating point value in seconds of the length of the cdrom track. Note, track 0 is the first track on the CD. Track numbers start at zero.
 
 
Edit on GitHub
