Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / cd-parser-objects.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="player-objects.html" />
<link rel="parent" href="module-cd.html" />
<link rel="next" href="module-fl.html" />
<meta name='aesop' content='information' />
<title>20.3.2 Parser Objects</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="20.3.1 Player Objects"
href="player-objects.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="20.3 cd "
href="module-cd.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="20.4 fl "
href="module-fl.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="player-objects.html">20.3.1 Player Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-cd.html">20.3 cd </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-fl.html">20.4 fl </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION0022320000000000000000"></A>
<A NAME="cd-parser-objects"></A>
<BR>
20.3.2 Parser Objects
</H2>
<P>
Parser objects (returned by <tt class="function">createparser()</tt>) have the
following methods:
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-5106' xml:id='l2h-5106' class="method">addcallback</tt></b>(</nobr></td>
<td><var>type, func, arg</var>)</td></tr></table></dt>
<dd>
Adds a callback for the parser. The parser has callbacks for eight
different types of data in the digital audio data stream. Constants
for these types are defined at the <tt class="module">cd</tt> module level (see above).
The callback is called as follows: <code><var>func</var>(<var>arg</var>, type,
data)</code>, where <var>arg</var> is the user supplied argument, <var>type</var> is
the particular type of callback, and <var>data</var> is the data returned
for this <var>type</var> of callback. The type of the data depends on the
<var>type</var> of callback as follows:
<P>
<div class="center"><table class="realtable">
<thead>
<tr>
<th class="left" >Type</th>
<th class="left" >Value</th>
</tr>
</thead>
<tbody>
<tr><td class="left" valign="baseline"><code>audio</code></td>
<td class="left" >String which can be passed unmodified to
<tt class="function">al.writesamps()</tt>.</td></tr>
<tr><td class="left" valign="baseline"><code>pnum</code></td>
<td class="left" >Integer giving the program (track) number.</td></tr>
<tr><td class="left" valign="baseline"><code>index</code></td>
<td class="left" >Integer giving the index number.</td></tr>
<tr><td class="left" valign="baseline"><code>ptime</code></td>
<td class="left" >Tuple consisting of the program time in minutes,
seconds, and frames.</td></tr>
<tr><td class="left" valign="baseline"><code>atime</code></td>
<td class="left" >Tuple consisting of the absolute time in minutes,
seconds, and frames.</td></tr>
<tr><td class="left" valign="baseline"><code>catalog</code></td>
<td class="left" >String of 13 characters, giving the catalog number
of the CD.</td></tr>
<tr><td class="left" valign="baseline"><code>ident</code></td>
<td class="left" >String of 12 characters, giving the ISRC
identification number of the recording. The string consists of two
characters country code, three characters owner code, two characters
giving the year, and five characters giving a serial number.</td></tr>
<tr><td class="left" valign="baseline"><code>control</code></td>
<td class="left" >Integer giving the control bits from the CD
subcode data</td></tr></tbody>
</table></div>
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-5107' xml:id='l2h-5107' class="method">deleteparser</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Deletes the parser and frees the memory it was using. The object
should not be used after this call. This call is done automatically
when the last reference to the object is removed.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-5108' xml:id='l2h-5108' class="method">parseframe</tt></b>(</nobr></td>
<td><var>frame</var>)</td></tr></table></dt>
<dd>
Parses one or more frames of digital audio data from a CD such as
returned by <tt class="method">readda()</tt>. It determines which subcodes are
present in the data. If these subcodes have changed since the last
frame, then <tt class="method">parseframe()</tt> executes a callback of the
appropriate type passing to it the subcode data found in the frame.
Unlike the C function, more than one frame of digital audio data
can be passed to this method.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-5109' xml:id='l2h-5109' class="method">removecallback</tt></b>(</nobr></td>
<td><var>type</var>)</td></tr></table></dt>
<dd>
Removes the callback for the given <var>type</var>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-5110' xml:id='l2h-5110' class="method">resetparser</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Resets the fields of the parser used for tracking subcodes to an
initial state. <tt class="method">resetparser()</tt> should be called after the disc
has been changed.
</dl>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="20.3.1 Player Objects"
href="player-objects.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="20.3 cd "
href="module-cd.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="20.4 fl "
href="module-fl.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="player-objects.html">20.3.1 Player Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-cd.html">20.3 cd </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-fl.html">20.4 fl </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>