Movatterモバイル変換


[0]ホーム

URL:


Up one LevelPython Library ReferenceContentsModule IndexIndex


34.3.1 Player Objects

Player objects (returned byopen()) have the followingmethods:

allowremoval()
Unlocks the eject button on the CD-ROM drive permitting the user toeject the caddy if desired.

bestreadsize()
Returns the best value to use for thenum_frames parameter ofthereadda() method. Best is defined as the value thatpermits a continuous flow of data from the CD-ROM drive.

close()
Frees the resources associated with the player object. After callingclose(), the methods of the object should no longer be used.

eject()
Ejects the caddy from the CD-ROM drive.

getstatus()
Returns information pertaining to the current state of the CD-ROMdrive. The returned information is a tuple with the following values:state,track,rtime,atime,ttime,first,last,scsi_audio,cur_block.rtime is the time relative to the start of the current track;atime is the time relative to the beginning of the disc;ttime is the total time on the disc. For more information onthe meaning of the values, see the man pageCDgetstatus(3dm).The value ofstate is one of the following:ERROR,NODISC,READY,PLAYING,PAUSED,STILL, orCDROM.

gettrackinfo(track)
Returns information about the specified track. The returnedinformation is a tuple consisting of two elements, the start time ofthe track and the duration of the track.

msftoblock(min, sec, frame)
Converts a minutes, seconds, frames triple representing a time inabsolute time code into the corresponding logical block number for thegiven CD-ROM drive. You should usemsftoframe() rather thanmsftoblock() for comparing times. The logical block numberdiffers from the frame number by an offset required by certain CD-ROMdrives.

play(start, play)
Starts playback of an audio CD in the CD-ROM drive at the specifiedtrack. The audio output appears on the CD-ROM drive's headphone andaudio jacks (if fitted). Play stops at the end of the disc.start is the number of the track at which to start playing theCD; ifplay is 0, the CD will be set to an initial pausedstate. The methodtogglepause() can then be used to commenceplay.

playabs(minutes, seconds, frames, play)
Likeplay(), except that the start is given in minutes,seconds, and frames instead of a track number.

playtrack(start, play)
Likeplay(), except that playing stops at the end of thetrack.

playtrackabs(track, minutes, seconds, frames, play)
Likeplay(), except that playing begins at the specifiedabsolute time and ends at the end of the specified track.

preventremoval()
Locks the eject button on the CD-ROM drive thus preventing the userfrom arbitrarily ejecting the caddy.

readda(num_frames)
Reads the specified number of frames from an audio CD mounted in theCD-ROM drive. The return value is a string representing the audioframes. This string can be passed unaltered to theparseframe() method of the parser object.

seek(minutes, seconds, frames)
Sets the pointer that indicates the starting point of the next read ofdigital audio data from a CD-ROM. The pointer is set to an absolutetime code location specified inminutes,seconds, andframes. The return value is the logical block number to whichthe pointer has been set.

seekblock(block)
Sets the pointer that indicates the starting point of the next read ofdigital audio data from a CD-ROM. The pointer is set to the specifiedlogical block number. The return value is the logical block number towhich the pointer has been set.

seektrack(track)
Sets the pointer that indicates the starting point of the next read ofdigital audio data from a CD-ROM. The pointer is set to the specifiedtrack. The return value is the logical block number to which thepointer has been set.

stop()
Stops the current playing operation.

togglepause()
Pauses the CD if it is playing, and makes it play if it is paused.


Up one LevelPython Library ReferenceContentsModule IndexIndex

Release 2.5.2, documentation updated on 21st February, 2008.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2025 Movatter.jp