Files
stk/doc/html/classstk_1_1Iir.html
2013-09-29 23:44:33 +02:00

298 lines
18 KiB
HTML

<HTML>
<HEAD>
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="faq.html">FAQ</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1Iir.html">Iir</a>
</div>
<div class="contents">
<h1>stk::Iir Class Reference</h1><!-- doxytag: class="stk::Iir" --><!-- doxytag: inherits="stk::Filter" -->STK general infinite impulse response filter class.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="Iir_8h-source.html">Iir.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for stk::Iir:</div>
<div class="dynsection">
<p><center><img src="classstk_1_1Iir.png" usemap="#stk::Iir_map" border="0" alt=""></center>
<map name="stk::Iir_map">
<area href="classstk_1_1Filter.html" alt="stk::Filter" shape="rect" coords="0,56,62,80">
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,62,24">
</map>
</div>
<p>
<a href="classstk_1_1Iir-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1d63797b4caf775de8d351ec0c15a4c0"></a><!-- doxytag: member="stk::Iir::Iir" ref="1d63797b4caf775de8d351ec0c15a4c0" args="(void)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#1d63797b4caf775de8d351ec0c15a4c0">Iir</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor creates a zero-order pass-through "filter". <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#b011114d45e4f5b1222e07070c9bdc38">Iir</a> (std::vector&lt; StkFloat &gt; &amp;bCoefficients, std::vector&lt; StkFloat &gt; &amp;aCoefficients)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overloaded constructor which takes filter coefficients. <a href="#b011114d45e4f5b1222e07070c9bdc38"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c15361cbfa19e6e4f73a155abc1459a8"></a><!-- doxytag: member="stk::Iir::~Iir" ref="c15361cbfa19e6e4f73a155abc1459a8" args="(void)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#c15361cbfa19e6e4f73a155abc1459a8">~Iir</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Class destructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#a0249b92dcec86ae83688debedb8d95b">setCoefficients</a> (std::vector&lt; StkFloat &gt; &amp;bCoefficients, std::vector&lt; StkFloat &gt; &amp;aCoefficients, bool clearState=false)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set filter coefficients. <a href="#a0249b92dcec86ae83688debedb8d95b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#7a1473446857a14cdbb33cb5afde076c">setNumerator</a> (std::vector&lt; StkFloat &gt; &amp;bCoefficients, bool clearState=false)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set numerator coefficients. <a href="#7a1473446857a14cdbb33cb5afde076c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#e67cc04a452edfbd80f1a27097ea0187">setDenominator</a> (std::vector&lt; StkFloat &gt; &amp;aCoefficients, bool clearState=false)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set denominator coefficients. <a href="#e67cc04a452edfbd80f1a27097ea0187"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5dcae9330f2c52d2bfa1647e6b250a14"></a><!-- doxytag: member="stk::Iir::lastOut" ref="5dcae9330f2c52d2bfa1647e6b250a14" args="(void) const " -->
StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#5dcae9330f2c52d2bfa1647e6b250a14">lastOut</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the last computed output value. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9b79bb8ba512052a4b90444c9d2d0d84"></a><!-- doxytag: member="stk::Iir::tick" ref="9b79bb8ba512052a4b90444c9d2d0d84" args="(StkFloat input)" -->
StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#9b79bb8ba512052a4b90444c9d2d0d84">tick</a> (StkFloat input)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Input one sample to the filter and return one output. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#d03f40e022b2adfe942d30908ec34793">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;frames, unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Take a channel of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object as inputs to the filter and replace with corresponding outputs. <a href="#d03f40e022b2adfe942d30908ec34793"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Iir.html#60919d8e000bf83613bdd5e002d750f1">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;iFrames, <a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;oFrames, unsigned int iChannel=0, unsigned int oChannel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Take a channel of the <code>iFrames</code> object as inputs to the filter and write outputs to the <code>oFrames</code> object. <a href="#60919d8e000bf83613bdd5e002d750f1"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
STK general infinite impulse response filter class.
<p>
This class provides a generic digital filter structure that can be used to implement IIR filters. For filters containing only feedforward terms, the <a class="el" href="classstk_1_1Fir.html" title="STK general finite impulse response filter class.">Fir</a> class is slightly more efficient.<p>
In particular, this class implements the standard difference equation:<p>
a[0]*y[n] = b[0]*x[n] + ... + b[nb]*x[n-nb] - a[1]*y[n-1] - ... - a[na]*y[n-na]<p>
If a[0] is not equal to 1, the filter coeffcients are normalized by a[0].<p>
The <em>gain</em> parameter is applied at the filter input and does not affect the coefficient values. The default gain value is 1.0. This structure results in one extra multiply per computed sample, but allows easy control of the overall filter gain.<p>
by Perry R. Cook and Gary P. Scavone, 1995 - 2009. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="b011114d45e4f5b1222e07070c9bdc38"></a><!-- doxytag: member="stk::Iir::Iir" ref="b011114d45e4f5b1222e07070c9bdc38" args="(std::vector&lt; StkFloat &gt; &amp;bCoefficients, std::vector&lt; StkFloat &gt; &amp;aCoefficients)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">stk::Iir::Iir </td>
<td>(</td>
<td class="paramtype">std::vector&lt; StkFloat &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>bCoefficients</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::vector&lt; StkFloat &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>aCoefficients</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Overloaded constructor which takes filter coefficients.
<p>
An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> can be thrown if either of the coefficient vector sizes is zero, or if the a[0] coefficient is equal to zero.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a0249b92dcec86ae83688debedb8d95b"></a><!-- doxytag: member="stk::Iir::setCoefficients" ref="a0249b92dcec86ae83688debedb8d95b" args="(std::vector&lt; StkFloat &gt; &amp;bCoefficients, std::vector&lt; StkFloat &gt; &amp;aCoefficients, bool clearState=false)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Iir::setCoefficients </td>
<td>(</td>
<td class="paramtype">std::vector&lt; StkFloat &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>bCoefficients</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::vector&lt; StkFloat &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>aCoefficients</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>clearState</em> = <code>false</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set filter coefficients.
<p>
An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> can be thrown if either of the coefficient vector sizes is zero, or if the a[0] coefficient is equal to zero. If a[0] is not equal to 1, the filter coeffcients are normalized by a[0]. The internal state of the filter is not cleared unless the <em>clearState</em> flag is <code>true</code>.
</div>
</div><p>
<a class="anchor" name="7a1473446857a14cdbb33cb5afde076c"></a><!-- doxytag: member="stk::Iir::setNumerator" ref="7a1473446857a14cdbb33cb5afde076c" args="(std::vector&lt; StkFloat &gt; &amp;bCoefficients, bool clearState=false)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Iir::setNumerator </td>
<td>(</td>
<td class="paramtype">std::vector&lt; StkFloat &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>bCoefficients</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>clearState</em> = <code>false</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set numerator coefficients.
<p>
An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> can be thrown if coefficient vector is empty. Any previously set denominator coefficients are left unaffected. Note that the default constructor sets the single denominator coefficient a[0] to 1.0. The internal state of the filter is not cleared unless the <em>clearState</em> flag is <code>true</code>.
</div>
</div><p>
<a class="anchor" name="e67cc04a452edfbd80f1a27097ea0187"></a><!-- doxytag: member="stk::Iir::setDenominator" ref="e67cc04a452edfbd80f1a27097ea0187" args="(std::vector&lt; StkFloat &gt; &amp;aCoefficients, bool clearState=false)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Iir::setDenominator </td>
<td>(</td>
<td class="paramtype">std::vector&lt; StkFloat &gt; &amp;&nbsp;</td>
<td class="paramname"> <em>aCoefficients</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&nbsp;</td>
<td class="paramname"> <em>clearState</em> = <code>false</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set denominator coefficients.
<p>
An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> can be thrown if the coefficient vector is empty or if the a[0] coefficient is equal to zero. Previously set numerator coefficients are unaffected unless a[0] is not equal to 1, in which case all coeffcients are normalized by a[0]. Note that the default constructor sets the single numerator coefficient b[0] to 1.0. The internal state of the filter is not cleared unless the <em>clearState</em> flag is <code>true</code>.
</div>
</div><p>
<a class="anchor" name="d03f40e022b2adfe942d30908ec34793"></a><!-- doxytag: member="stk::Iir::tick" ref="d03f40e022b2adfe942d30908ec34793" args="(StkFrames &amp;frames, unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp; stk::Iir::tick </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
<td class="paramname"> <em>frames</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>channel</em> = <code>0</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Take a channel of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object as inputs to the filter and replace with corresponding outputs.
<p>
The <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument reference is returned. The <code>channel</code> argument must be less than the number of channels in the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception.
<p>Implements <a class="el" href="classstk_1_1Filter.html#3260a238824c4a748ac057b84b7d3f21">stk::Filter</a>.</p>
</div>
</div><p>
<a class="anchor" name="60919d8e000bf83613bdd5e002d750f1"></a><!-- doxytag: member="stk::Iir::tick" ref="60919d8e000bf83613bdd5e002d750f1" args="(StkFrames &amp;iFrames, StkFrames &amp;oFrames, unsigned int iChannel=0, unsigned int oChannel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp; stk::Iir::tick </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
<td class="paramname"> <em>iFrames</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
<td class="paramname"> <em>oFrames</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>iChannel</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>oChannel</em> = <code>0</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Take a channel of the <code>iFrames</code> object as inputs to the filter and write outputs to the <code>oFrames</code> object.
<p>
The <code>iFrames</code> object reference is returned. Each channel argument must be less than the number of channels in the corresponding <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception.
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Iir_8h-source.html">Iir.h</a></ul>
</div>
<HR>
<table>
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>&copy;1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>