Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{cd} --- |
Fred Drake | 67d229e | 1999-02-20 04:51:16 +0000 | [diff] [blame] | 2 | CD-ROM access on SGI systems} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 3 | |
Fred Drake | 67d229e | 1999-02-20 04:51:16 +0000 | [diff] [blame] | 4 | \declaremodule{builtin}{cd} |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 5 | \platform{IRIX} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 6 | \modulesynopsis{Interface to the CD-ROM on Silicon Graphics systems.} |
| 7 | |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 8 | |
| 9 | This module provides an interface to the Silicon Graphics CD library. |
| 10 | It is available only on Silicon Graphics systems. |
| 11 | |
| 12 | The way the library works is as follows. A program opens the CD-ROM |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 13 | device with \function{open()} and creates a parser to parse the data |
| 14 | from the CD with \function{createparser()}. The object returned by |
| 15 | \function{open()} can be used to read data from the CD, but also to get |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 16 | status information for the CD-ROM device, and to get information about |
| 17 | the CD, such as the table of contents. Data from the CD is passed to |
| 18 | the parser, which parses the frames, and calls any callback |
| 19 | functions that have previously been added. |
| 20 | |
| 21 | An audio CD is divided into \dfn{tracks} or \dfn{programs} (the terms |
| 22 | are used interchangeably). Tracks can be subdivided into |
| 23 | \dfn{indices}. An audio CD contains a \dfn{table of contents} which |
| 24 | gives the starts of the tracks on the CD. Index 0 is usually the |
| 25 | pause before the start of a track. The start of the track as given by |
| 26 | the table of contents is normally the start of index 1. |
| 27 | |
| 28 | Positions on a CD can be represented in two ways. Either a frame |
| 29 | number or a tuple of three values, minutes, seconds and frames. Most |
| 30 | functions use the latter representation. Positions can be both |
| 31 | relative to the beginning of the CD, and to the beginning of the |
| 32 | track. |
| 33 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 34 | Module \module{cd} defines the following functions and constants: |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 35 | |
Guido van Rossum | d45c156 | 1995-03-30 11:47:50 +0000 | [diff] [blame] | 36 | |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 37 | \begin{funcdesc}{createparser}{} |
| 38 | Create and return an opaque parser object. The methods of the parser |
| 39 | object are described below. |
| 40 | \end{funcdesc} |
| 41 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 42 | \begin{funcdesc}{msftoframe}{minutes, seconds, frames} |
| 43 | Converts a \code{(\var{minutes}, \var{seconds}, \var{frames})} triple |
| 44 | representing time in absolute time code into the corresponding CD |
| 45 | frame number. |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 46 | \end{funcdesc} |
| 47 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 48 | \begin{funcdesc}{open}{\optional{device\optional{, mode}}} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 49 | Open the CD-ROM device. The return value is an opaque player object; |
| 50 | methods of the player object are described below. The device is the |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 51 | name of the SCSI device file, e.g. \code{'/dev/scsi/sc0d4l0'}, or |
| 52 | \code{None}. If omitted or \code{None}, the hardware inventory is |
| 53 | consulted to locate a CD-ROM drive. The \var{mode}, if not omited, |
| 54 | should be the string \code{'r'}. |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 55 | \end{funcdesc} |
| 56 | |
| 57 | The module defines the following variables: |
| 58 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 59 | \begin{excdesc}{error} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 60 | Exception raised on various errors. |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 61 | \end{excdesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 62 | |
| 63 | \begin{datadesc}{DATASIZE} |
| 64 | The size of one frame's worth of audio data. This is the size of the |
| 65 | audio data as passed to the callback of type \code{audio}. |
| 66 | \end{datadesc} |
| 67 | |
| 68 | \begin{datadesc}{BLOCKSIZE} |
| 69 | The size of one uninterpreted frame of audio data. |
| 70 | \end{datadesc} |
| 71 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 72 | The following variables are states as returned by |
| 73 | \function{getstatus()}: |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 74 | |
| 75 | \begin{datadesc}{READY} |
| 76 | The drive is ready for operation loaded with an audio CD. |
| 77 | \end{datadesc} |
| 78 | |
| 79 | \begin{datadesc}{NODISC} |
| 80 | The drive does not have a CD loaded. |
| 81 | \end{datadesc} |
| 82 | |
| 83 | \begin{datadesc}{CDROM} |
| 84 | The drive is loaded with a CD-ROM. Subsequent play or read operations |
| 85 | will return I/O errors. |
| 86 | \end{datadesc} |
| 87 | |
| 88 | \begin{datadesc}{ERROR} |
Thomas Wouters | f831663 | 2000-07-16 19:01:10 +0000 | [diff] [blame] | 89 | An error occurred while trying to read the disc or its table of |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 90 | contents. |
| 91 | \end{datadesc} |
| 92 | |
| 93 | \begin{datadesc}{PLAYING} |
| 94 | The drive is in CD player mode playing an audio CD through its audio |
| 95 | jacks. |
| 96 | \end{datadesc} |
| 97 | |
| 98 | \begin{datadesc}{PAUSED} |
| 99 | The drive is in CD layer mode with play paused. |
| 100 | \end{datadesc} |
| 101 | |
| 102 | \begin{datadesc}{STILL} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 103 | The equivalent of \constant{PAUSED} on older (non 3301) model Toshiba |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 104 | CD-ROM drives. Such drives have never been shipped by SGI. |
| 105 | \end{datadesc} |
| 106 | |
Guido van Rossum | d45c156 | 1995-03-30 11:47:50 +0000 | [diff] [blame] | 107 | \begin{datadesc}{audio} |
| 108 | \dataline{pnum} |
| 109 | \dataline{index} |
| 110 | \dataline{ptime} |
| 111 | \dataline{atime} |
| 112 | \dataline{catalog} |
| 113 | \dataline{ident} |
| 114 | \dataline{control} |
| 115 | Integer constants describing the various types of parser callbacks |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 116 | that can be set by the \method{addcallback()} method of CD parser |
Guido van Rossum | d45c156 | 1995-03-30 11:47:50 +0000 | [diff] [blame] | 117 | objects (see below). |
| 118 | \end{datadesc} |
| 119 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 120 | |
| 121 | \subsection{Player Objects} |
| 122 | \label{player-objects} |
| 123 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 124 | Player objects (returned by \function{open()}) have the following |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 125 | methods: |
| 126 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 127 | \begin{methoddesc}[CD player]{allowremoval}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 128 | Unlocks the eject button on the CD-ROM drive permitting the user to |
| 129 | eject the caddy if desired. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 130 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 131 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 132 | \begin{methoddesc}[CD player]{bestreadsize}{} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 133 | Returns the best value to use for the \var{num_frames} parameter of |
| 134 | the \method{readda()} method. Best is defined as the value that |
| 135 | permits a continuous flow of data from the CD-ROM drive. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 136 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 137 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 138 | \begin{methoddesc}[CD player]{close}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 139 | Frees the resources associated with the player object. After calling |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 140 | \method{close()}, the methods of the object should no longer be used. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 141 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 142 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 143 | \begin{methoddesc}[CD player]{eject}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 144 | Ejects the caddy from the CD-ROM drive. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 145 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 146 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 147 | \begin{methoddesc}[CD player]{getstatus}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 148 | Returns information pertaining to the current state of the CD-ROM |
| 149 | drive. The returned information is a tuple with the following values: |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 150 | \var{state}, \var{track}, \var{rtime}, \var{atime}, \var{ttime}, |
| 151 | \var{first}, \var{last}, \var{scsi_audio}, \var{cur_block}. |
| 152 | \var{rtime} is the time relative to the start of the current track; |
| 153 | \var{atime} is the time relative to the beginning of the disc; |
| 154 | \var{ttime} is the total time on the disc. For more information on |
| 155 | the meaning of the values, see the man page \manpage{CDgetstatus}{3dm}. |
| 156 | The value of \var{state} is one of the following: \constant{ERROR}, |
| 157 | \constant{NODISC}, \constant{READY}, \constant{PLAYING}, |
| 158 | \constant{PAUSED}, \constant{STILL}, or \constant{CDROM}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 159 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 160 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 161 | \begin{methoddesc}[CD player]{gettrackinfo}{track} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 162 | Returns information about the specified track. The returned |
| 163 | information is a tuple consisting of two elements, the start time of |
| 164 | the track and the duration of the track. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 165 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 166 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 167 | \begin{methoddesc}[CD player]{msftoblock}{min, sec, frame} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 168 | Converts a minutes, seconds, frames triple representing a time in |
| 169 | absolute time code into the corresponding logical block number for the |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 170 | given CD-ROM drive. You should use \function{msftoframe()} rather than |
| 171 | \method{msftoblock()} for comparing times. The logical block number |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 172 | differs from the frame number by an offset required by certain CD-ROM |
| 173 | drives. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 174 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 175 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 176 | \begin{methoddesc}[CD player]{play}{start, play} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 177 | Starts playback of an audio CD in the CD-ROM drive at the specified |
| 178 | track. The audio output appears on the CD-ROM drive's headphone and |
| 179 | audio jacks (if fitted). Play stops at the end of the disc. |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 180 | \var{start} is the number of the track at which to start playing the |
| 181 | CD; if \var{play} is 0, the CD will be set to an initial paused |
| 182 | state. The method \method{togglepause()} can then be used to commence |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 183 | play. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 184 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 185 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 186 | \begin{methoddesc}[CD player]{playabs}{minutes, seconds, frames, play} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 187 | Like \method{play()}, except that the start is given in minutes, |
| 188 | seconds, and frames instead of a track number. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 189 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 190 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 191 | \begin{methoddesc}[CD player]{playtrack}{start, play} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 192 | Like \method{play()}, except that playing stops at the end of the |
| 193 | track. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 194 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 195 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 196 | \begin{methoddesc}[CD player]{playtrackabs}{track, minutes, seconds, frames, play} |
Thomas Wouters | f831663 | 2000-07-16 19:01:10 +0000 | [diff] [blame] | 197 | Like \method{play()}, except that playing begins at the specified |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 198 | absolute time and ends at the end of the specified track. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 199 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 200 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 201 | \begin{methoddesc}[CD player]{preventremoval}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 202 | Locks the eject button on the CD-ROM drive thus preventing the user |
| 203 | from arbitrarily ejecting the caddy. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 204 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 205 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 206 | \begin{methoddesc}[CD player]{readda}{num_frames} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 207 | Reads the specified number of frames from an audio CD mounted in the |
| 208 | CD-ROM drive. The return value is a string representing the audio |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 209 | frames. This string can be passed unaltered to the |
| 210 | \method{parseframe()} method of the parser object. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 211 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 212 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 213 | \begin{methoddesc}[CD player]{seek}{minutes, seconds, frames} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 214 | Sets the pointer that indicates the starting point of the next read of |
| 215 | digital audio data from a CD-ROM. The pointer is set to an absolute |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 216 | time code location specified in \var{minutes}, \var{seconds}, and |
| 217 | \var{frames}. The return value is the logical block number to which |
| 218 | the pointer has been set. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 219 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 220 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 221 | \begin{methoddesc}[CD player]{seekblock}{block} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 222 | Sets the pointer that indicates the starting point of the next read of |
| 223 | digital audio data from a CD-ROM. The pointer is set to the specified |
| 224 | logical block number. The return value is the logical block number to |
| 225 | which the pointer has been set. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 226 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 227 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 228 | \begin{methoddesc}[CD player]{seektrack}{track} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 229 | Sets the pointer that indicates the starting point of the next read of |
| 230 | digital audio data from a CD-ROM. The pointer is set to the specified |
| 231 | track. The return value is the logical block number to which the |
| 232 | pointer has been set. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 233 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 234 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 235 | \begin{methoddesc}[CD player]{stop}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 236 | Stops the current playing operation. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 237 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 238 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 239 | \begin{methoddesc}[CD player]{togglepause}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 240 | Pauses the CD if it is playing, and makes it play if it is paused. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 241 | \end{methoddesc} |
| 242 | |
| 243 | |
| 244 | \subsection{Parser Objects} |
| 245 | \label{cd-parser-objects} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 246 | |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 247 | Parser objects (returned by \function{createparser()}) have the |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 248 | following methods: |
| 249 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 250 | \begin{methoddesc}[CD parser]{addcallback}{type, func, arg} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 251 | Adds a callback for the parser. The parser has callbacks for eight |
Guido van Rossum | d45c156 | 1995-03-30 11:47:50 +0000 | [diff] [blame] | 252 | different types of data in the digital audio data stream. Constants |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 253 | for these types are defined at the \module{cd} module level (see above). |
| 254 | The callback is called as follows: \code{\var{func}(\var{arg}, type, |
| 255 | data)}, where \var{arg} is the user supplied argument, \var{type} is |
| 256 | the particular type of callback, and \var{data} is the data returned |
| 257 | for this \var{type} of callback. The type of the data depends on the |
| 258 | \var{type} of callback as follows: |
| 259 | |
Fred Drake | ee60191 | 1998-04-11 20:53:03 +0000 | [diff] [blame] | 260 | \begin{tableii}{l|p{4in}}{code}{Type}{Value} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 261 | \lineii{audio}{String which can be passed unmodified to |
| 262 | \function{al.writesamps()}.} |
| 263 | \lineii{pnum}{Integer giving the program (track) number.} |
| 264 | \lineii{index}{Integer giving the index number.} |
| 265 | \lineii{ptime}{Tuple consisting of the program time in minutes, |
| 266 | seconds, and frames.} |
| 267 | \lineii{atime}{Tuple consisting of the absolute time in minutes, |
| 268 | seconds, and frames.} |
| 269 | \lineii{catalog}{String of 13 characters, giving the catalog number |
| 270 | of the CD.} |
| 271 | \lineii{ident}{String of 12 characters, giving the ISRC |
Fred Drake | 0d213d3 | 1998-04-11 16:40:46 +0000 | [diff] [blame] | 272 | identification number of the recording. The string consists of two |
| 273 | characters country code, three characters owner code, two characters |
| 274 | giving the year, and five characters giving a serial number.} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 275 | \lineii{control}{Integer giving the control bits from the CD |
| 276 | subcode data} |
| 277 | \end{tableii} |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 278 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 279 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 280 | \begin{methoddesc}[CD parser]{deleteparser}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 281 | Deletes the parser and frees the memory it was using. The object |
| 282 | should not be used after this call. This call is done automatically |
| 283 | when the last reference to the object is removed. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 284 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 285 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 286 | \begin{methoddesc}[CD parser]{parseframe}{frame} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 287 | Parses one or more frames of digital audio data from a CD such as |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 288 | returned by \method{readda()}. It determines which subcodes are |
| 289 | present in the data. If these subcodes have changed since the last |
| 290 | frame, then \method{parseframe()} executes a callback of the |
| 291 | appropriate type passing to it the subcode data found in the frame. |
| 292 | Unlike the \C{} function, more than one frame of digital audio data |
| 293 | can be passed to this method. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 294 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 295 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 296 | \begin{methoddesc}[CD parser]{removecallback}{type} |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 297 | Removes the callback for the given \var{type}. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 298 | \end{methoddesc} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 299 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 300 | \begin{methoddesc}[CD parser]{resetparser}{} |
Sjoerd Mullender | ffd6de1 | 1995-03-28 11:56:52 +0000 | [diff] [blame] | 301 | Resets the fields of the parser used for tracking subcodes to an |
Fred Drake | d98329c | 1998-03-16 06:38:42 +0000 | [diff] [blame] | 302 | initial state. \method{resetparser()} should be called after the disc |
| 303 | has been changed. |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 304 | \end{methoddesc} |