mirror of
https://github.com/thestk/stk
synced 2026-01-13 13:01:52 +00:00
299 lines
12 KiB
HTML
299 lines
12 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"> <img src="ccrma.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.2.8.1 -->
|
|
<h1>Filter Class Reference</h1>STK filter class.
|
|
<a href="#_details">More...</a>
|
|
<p>
|
|
<code>#include <<a class="el" href="Filter_8h-source.html">Filter.h</a>></code>
|
|
<p>
|
|
<p>Inheritance diagram for Filter::
|
|
<p><center><img src="classFilter.gif" usemap="#Filter_map" border="0"></center>
|
|
<map name="Filter_map">
|
|
<area href="classStk.html" alt="Stk" shape="rect" coords="287,0,359,24">
|
|
<area href="classBiQuad.html" alt="BiQuad" shape="rect" coords="0,112,72,136">
|
|
<area href="classDelay.html" alt="Delay" shape="rect" coords="123,112,195,136">
|
|
<area href="classOnePole.html" alt="OnePole" shape="rect" coords="205,112,277,136">
|
|
<area href="classOneZero.html" alt="OneZero" shape="rect" coords="287,112,359,136">
|
|
<area href="classPoleZero.html" alt="PoleZero" shape="rect" coords="369,112,441,136">
|
|
<area href="classTwoPole.html" alt="TwoPole" shape="rect" coords="451,112,523,136">
|
|
<area href="classTwoZero.html" alt="TwoZero" shape="rect" coords="533,112,605,136">
|
|
<area href="classFormSwep.html" alt="FormSwep" shape="rect" coords="0,168,72,192">
|
|
<area href="classDelayA.html" alt="DelayA" shape="rect" coords="82,168,154,192">
|
|
<area href="classDelayL.html" alt="DelayL" shape="rect" coords="164,168,236,192">
|
|
</map>
|
|
<a href="classFilter-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
|
|
<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a0" doxytag="Filter::Filter"></a>
|
|
</td><td valign=bottom><a class="el" href="classFilter.html#a0">Filter</a> (void)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Default constructor creates a zero-order pass-through "filter".</em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classFilter.html#a1">Filter</a> (int nb, MY_FLOAT *bCoefficients, int na, MY_FLOAT *aCoefficients)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Overloaded constructor which takes filter coefficients.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a2" doxytag="Filter::~Filter"></a>
|
|
virtual </td><td valign=bottom><a class="el" href="classFilter.html#a2">~Filter</a> (void)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Class destructor.</em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a3" doxytag="Filter::clear"></a>
|
|
void </td><td valign=bottom><a class="el" href="classFilter.html#a3">clear</a> (void)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Clears all internal states of the filter.</em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classFilter.html#a4">setCoefficients</a> (int nb, MY_FLOAT *bCoefficients, int na, MY_FLOAT *aCoefficients)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Set filter coefficients.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classFilter.html#a5">setNumerator</a> (int nb, MY_FLOAT *bCoefficients)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Set numerator coefficients.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classFilter.html#a6">setDenominator</a> (int na, MY_FLOAT *aCoefficients)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Set denominator coefficients.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classFilter.html#a7">setGain</a> (MY_FLOAT theGain)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Set the filter gain.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a8" doxytag="Filter::getGain"></a>
|
|
virtual MY_FLOAT </td><td valign=bottom><a class="el" href="classFilter.html#a8">getGain</a> (void) const</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Return the current filter gain.</em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a9" doxytag="Filter::lastOut"></a>
|
|
virtual MY_FLOAT </td><td valign=bottom><a class="el" href="classFilter.html#a9">lastOut</a> (void) const</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Return the last computed output value.</em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a10" doxytag="Filter::tick"></a>
|
|
virtual MY_FLOAT </td><td valign=bottom><a class="el" href="classFilter.html#a10">tick</a> (MY_FLOAT sample)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Input one sample to the filter and return one output.</em></font><br><br></td></tr>
|
|
<tr><td nowrap align=right valign=top><a name="a11" doxytag="Filter::tick"></a>
|
|
virtual MY_FLOAT* </td><td valign=bottom><a class="el" href="classFilter.html#a11">tick</a> (MY_FLOAT *vector, unsigned int vectorSize)</td></tr>
|
|
<tr><td> </td><td><font size=-1><em>Input <em>vectorSize</em> samples to the filter and return an equal number of outputs in <em>vector</em>.</em></font><br><br></td></tr>
|
|
</table>
|
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
STK filter class.
|
|
<p>
|
|
This class implements a generic structure which can be used to create a wide range of filters. It can function independently or be subclassed to provide more specific controls based on a particular filter type.
|
|
<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 - 2002.
|
|
<p>
|
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
|
<a name="a1" doxytag="Filter::Filter"></a><p>
|
|
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td nowrap valign="top"><b>
|
|
Filter::Filter (
|
|
</b></td>
|
|
<td valign="bottom"><b>
|
|
int <em>nb</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
MY_FLOAT * <em>bCoefficients</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
int <em>na</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
MY_FLOAT * <em>aCoefficients</em> )
|
|
</b></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Overloaded constructor which takes filter coefficients.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> can be thrown if either <em>nb</em> or <em>na</em> is less than one, or if the a[0] coefficient is equal to zero. </td>
|
|
</tr>
|
|
</table>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<a name="a4" doxytag="Filter::setCoefficients"></a><p>
|
|
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td nowrap valign="top"><b>
|
|
void Filter::setCoefficients (
|
|
</b></td>
|
|
<td valign="bottom"><b>
|
|
int <em>nb</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
MY_FLOAT * <em>bCoefficients</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
int <em>na</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
MY_FLOAT * <em>aCoefficients</em> )
|
|
</b></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set filter coefficients.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> can be thrown if either <em>nb</em> or <em>na</em> is less than one, 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]. </td>
|
|
</tr>
|
|
</table>
|
|
<a name="a5" doxytag="Filter::setNumerator"></a><p>
|
|
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td nowrap valign="top"><b>
|
|
void Filter::setNumerator (
|
|
</b></td>
|
|
<td valign="bottom"><b>
|
|
int <em>nb</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
MY_FLOAT * <em>bCoefficients</em> )
|
|
</b></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set numerator coefficients.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> can be thrown if <em>nb</em> is less than one. Any previously set denominator coefficients are left unaffected. Note that the default constructor sets the single denominator coefficient a[0] to 1.0. </td>
|
|
</tr>
|
|
</table>
|
|
<a name="a6" doxytag="Filter::setDenominator"></a><p>
|
|
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td nowrap valign="top"><b>
|
|
void Filter::setDenominator (
|
|
</b></td>
|
|
<td valign="bottom"><b>
|
|
int <em>na</em>,
|
|
</b></td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td><b>
|
|
MY_FLOAT * <em>aCoefficients</em> )
|
|
</b></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set denominator coefficients.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> can be thrown if <em>na</em> is less than one 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. </td>
|
|
</tr>
|
|
</table>
|
|
<a name="a7" doxytag="Filter::setGain"></a><p>
|
|
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td nowrap valign="top"><b>
|
|
void Filter::setGain (
|
|
</b></td>
|
|
<td valign="bottom"><b>
|
|
MY_FLOAT <em>theGain</em> )<code> [virtual]</code>
|
|
</b></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing=5 cellpadding=0 border=0>
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Set the filter gain.
|
|
<p>
|
|
The gain is applied at the filter input and does not affect the coefficient values. The default gain value is 1.0.
|
|
<p>
|
|
Reimplemented in <a class="el" href="classBiQuad.html#a11">BiQuad</a>, <a class="el" href="classOnePole.html#a7">OnePole</a>, <a class="el" href="classOneZero.html#a7">OneZero</a>, <a class="el" href="classPoleZero.html#a8">PoleZero</a>, <a class="el" href="classTwoPole.html#a7">TwoPole</a>, and <a class="el" href="classTwoZero.html#a7">TwoZero</a>. </td>
|
|
</tr>
|
|
</table>
|
|
<hr>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="Filter_8h-source.html">Filter.h</a></ul>
|
|
<HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2002 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|