| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="prev" href="player-objects.html" /> |
| 13 | <link rel="parent" href="module-cd.html" /> |
| 14 | <link rel="next" href="module-fl.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>20.3.2 Parser Objects</title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="20.3.1 Player Objects" |
| 24 | href="player-objects.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="20.3 cd " |
| 27 | href="module-cd.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="20.4 fl " |
| 30 | href="module-fl.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Python Library Reference</td> |
| 33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 34 | href="contents.html"><img src='../icons/contents.png' |
| 35 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 37 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 38 | <td class='online-navigation'><a rel="index" title="Index" |
| 39 | href="genindex.html"><img src='../icons/index.png' |
| 40 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 41 | </tr></table> |
| 42 | <div class='online-navigation'> |
| 43 | <b class="navlabel">Previous:</b> |
| 44 | <a class="sectref" rel="prev" href="player-objects.html">20.3.1 Player Objects</A> |
| 45 | <b class="navlabel">Up:</b> |
| 46 | <a class="sectref" rel="parent" href="module-cd.html">20.3 cd </A> |
| 47 | <b class="navlabel">Next:</b> |
| 48 | <a class="sectref" rel="next" href="module-fl.html">20.4 fl </A> |
| 49 | </div> |
| 50 | <hr /></div> |
| 51 | </DIV> |
| 52 | <!--End of Navigation Panel--> |
| 53 | |
| 54 | <H2><A NAME="SECTION0022320000000000000000"></A> |
| 55 | <A NAME="cd-parser-objects"></A> |
| 56 | <BR> |
| 57 | 20.3.2 Parser Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | Parser objects (returned by <tt class="function">createparser()</tt>) have the |
| 62 | following methods: |
| 63 | |
| 64 | <P> |
| 65 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 66 | <td><nobr><b><tt id='l2h-5106' xml:id='l2h-5106' class="method">addcallback</tt></b>(</nobr></td> |
| 67 | <td><var>type, func, arg</var>)</td></tr></table></dt> |
| 68 | <dd> |
| 69 | Adds a callback for the parser. The parser has callbacks for eight |
| 70 | different types of data in the digital audio data stream. Constants |
| 71 | for these types are defined at the <tt class="module">cd</tt> module level (see above). |
| 72 | The callback is called as follows: <code><var>func</var>(<var>arg</var>, type, |
| 73 | data)</code>, where <var>arg</var> is the user supplied argument, <var>type</var> is |
| 74 | the particular type of callback, and <var>data</var> is the data returned |
| 75 | for this <var>type</var> of callback. The type of the data depends on the |
| 76 | <var>type</var> of callback as follows: |
| 77 | |
| 78 | <P> |
| 79 | <div class="center"><table class="realtable"> |
| 80 | <thead> |
| 81 | <tr> |
| 82 | <th class="left" >Type</th> |
| 83 | <th class="left" >Value</th> |
| 84 | </tr> |
| 85 | </thead> |
| 86 | <tbody> |
| 87 | <tr><td class="left" valign="baseline"><code>audio</code></td> |
| 88 | <td class="left" >String which can be passed unmodified to |
| 89 | <tt class="function">al.writesamps()</tt>.</td></tr> |
| 90 | <tr><td class="left" valign="baseline"><code>pnum</code></td> |
| 91 | <td class="left" >Integer giving the program (track) number.</td></tr> |
| 92 | <tr><td class="left" valign="baseline"><code>index</code></td> |
| 93 | <td class="left" >Integer giving the index number.</td></tr> |
| 94 | <tr><td class="left" valign="baseline"><code>ptime</code></td> |
| 95 | <td class="left" >Tuple consisting of the program time in minutes, |
| 96 | seconds, and frames.</td></tr> |
| 97 | <tr><td class="left" valign="baseline"><code>atime</code></td> |
| 98 | <td class="left" >Tuple consisting of the absolute time in minutes, |
| 99 | seconds, and frames.</td></tr> |
| 100 | <tr><td class="left" valign="baseline"><code>catalog</code></td> |
| 101 | <td class="left" >String of 13 characters, giving the catalog number |
| 102 | of the CD.</td></tr> |
| 103 | <tr><td class="left" valign="baseline"><code>ident</code></td> |
| 104 | <td class="left" >String of 12 characters, giving the ISRC |
| 105 | identification number of the recording. The string consists of two |
| 106 | characters country code, three characters owner code, two characters |
| 107 | giving the year, and five characters giving a serial number.</td></tr> |
| 108 | <tr><td class="left" valign="baseline"><code>control</code></td> |
| 109 | <td class="left" >Integer giving the control bits from the CD |
| 110 | subcode data</td></tr></tbody> |
| 111 | </table></div> |
| 112 | </dl> |
| 113 | |
| 114 | <P> |
| 115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 116 | <td><nobr><b><tt id='l2h-5107' xml:id='l2h-5107' class="method">deleteparser</tt></b>(</nobr></td> |
| 117 | <td><var></var>)</td></tr></table></dt> |
| 118 | <dd> |
| 119 | Deletes the parser and frees the memory it was using. The object |
| 120 | should not be used after this call. This call is done automatically |
| 121 | when the last reference to the object is removed. |
| 122 | </dl> |
| 123 | |
| 124 | <P> |
| 125 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 126 | <td><nobr><b><tt id='l2h-5108' xml:id='l2h-5108' class="method">parseframe</tt></b>(</nobr></td> |
| 127 | <td><var>frame</var>)</td></tr></table></dt> |
| 128 | <dd> |
| 129 | Parses one or more frames of digital audio data from a CD such as |
| 130 | returned by <tt class="method">readda()</tt>. It determines which subcodes are |
| 131 | present in the data. If these subcodes have changed since the last |
| 132 | frame, then <tt class="method">parseframe()</tt> executes a callback of the |
| 133 | appropriate type passing to it the subcode data found in the frame. |
| 134 | Unlike the C function, more than one frame of digital audio data |
| 135 | can be passed to this method. |
| 136 | </dl> |
| 137 | |
| 138 | <P> |
| 139 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 140 | <td><nobr><b><tt id='l2h-5109' xml:id='l2h-5109' class="method">removecallback</tt></b>(</nobr></td> |
| 141 | <td><var>type</var>)</td></tr></table></dt> |
| 142 | <dd> |
| 143 | Removes the callback for the given <var>type</var>. |
| 144 | </dl> |
| 145 | |
| 146 | <P> |
| 147 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 148 | <td><nobr><b><tt id='l2h-5110' xml:id='l2h-5110' class="method">resetparser</tt></b>(</nobr></td> |
| 149 | <td><var></var>)</td></tr></table></dt> |
| 150 | <dd> |
| 151 | Resets the fields of the parser used for tracking subcodes to an |
| 152 | initial state. <tt class="method">resetparser()</tt> should be called after the disc |
| 153 | has been changed. |
| 154 | </dl> |
| 155 | |
| 156 | <DIV CLASS="navigation"> |
| 157 | <div class='online-navigation'> |
| 158 | <p></p><hr /> |
| 159 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 160 | <tr> |
| 161 | <td class='online-navigation'><a rel="prev" title="20.3.1 Player Objects" |
| 162 | href="player-objects.html"><img src='../icons/previous.png' |
| 163 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 164 | <td class='online-navigation'><a rel="parent" title="20.3 cd " |
| 165 | href="module-cd.html"><img src='../icons/up.png' |
| 166 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 167 | <td class='online-navigation'><a rel="next" title="20.4 fl " |
| 168 | href="module-fl.html"><img src='../icons/next.png' |
| 169 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 170 | <td align="center" width="100%">Python Library Reference</td> |
| 171 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 172 | href="contents.html"><img src='../icons/contents.png' |
| 173 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 174 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 175 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 176 | <td class='online-navigation'><a rel="index" title="Index" |
| 177 | href="genindex.html"><img src='../icons/index.png' |
| 178 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 179 | </tr></table> |
| 180 | <div class='online-navigation'> |
| 181 | <b class="navlabel">Previous:</b> |
| 182 | <a class="sectref" rel="prev" href="player-objects.html">20.3.1 Player Objects</A> |
| 183 | <b class="navlabel">Up:</b> |
| 184 | <a class="sectref" rel="parent" href="module-cd.html">20.3 cd </A> |
| 185 | <b class="navlabel">Next:</b> |
| 186 | <a class="sectref" rel="next" href="module-fl.html">20.4 fl </A> |
| 187 | </div> |
| 188 | </div> |
| 189 | <hr /> |
| 190 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 191 | </DIV> |
| 192 | <!--End of Navigation Panel--> |
| 193 | <ADDRESS> |
| 194 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 195 | </ADDRESS> |
| 196 | </BODY> |
| 197 | </HTML> |