mirror of
https://github.com/thestk/stk
synced 2026-01-13 04:51:53 +00:00
87 lines
8.8 KiB
HTML
87 lines
8.8 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"> <img src="mcgill.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="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.6.2 -->
|
|
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>Resonate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_RESONATE_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_RESONATE_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
|
<a name="l00005"></a>00005 <span class="preprocessor">#include "ADSR.h"</span>
|
|
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
|
<a name="l00007"></a>00007 <span class="preprocessor">#include "Noise.h"</span>
|
|
<a name="l00008"></a>00008
|
|
<a name="l00009"></a>00009 <span class="keyword">namespace </span>stk {
|
|
<a name="l00010"></a>00010
|
|
<a name="l00011"></a>00011 <span class="comment">/***************************************************/</span>
|
|
<a name="l00028"></a>00028 <span class="comment">/***************************************************/</span>
|
|
<a name="l00029"></a>00029
|
|
<a name="l00030"></a><a class="code" href="classstk_1_1Resonate.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Resonate.html" title="STK noise driven formant filter.">Resonate</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
|
<a name="l00031"></a>00031 {
|
|
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
|
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Resonate.html#ab273b41ec296f776a41cfa66bb1e430e" title="Class constructor.">Resonate</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00035"></a>00035
|
|
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Resonate.html#a634ab2db8eabad147fa90fb1bf72a580" title="Class destructor.">~Resonate</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00038"></a>00038
|
|
<a name="l00040"></a>00040 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#a534740efbbde171d790309e85c96017d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00041"></a>00041
|
|
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#a8767e6c05862c183483776ac4cf354f9" title="Set the filter for a resonance at the given frequency (Hz) and radius.">setResonance</a>( StkFloat frequency, StkFloat radius );
|
|
<a name="l00044"></a>00044
|
|
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#ad4476301fba545cbbfc773150ca6901d" title="Set the filter for a notch at the given frequency (Hz) and radius.">setNotch</a>( StkFloat frequency, StkFloat radius );
|
|
<a name="l00047"></a>00047
|
|
<a name="l00049"></a><a class="code" href="classstk_1_1Resonate.html#ad8000ad734634ac7334f4fab09a13a7e">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#ad8000ad734634ac7334f4fab09a13a7e" title="Set the filter zero coefficients for contant resonance gain.">setEqualGainZeroes</a>( <span class="keywordtype">void</span> ) { filter_.<a class="code" href="classstk_1_1BiQuad.html#a28881f5876ce5bdcc846367cca9363f7" title="Sets the filter zeroes for equal resonance gain.">setEqualGainZeroes</a>(); };
|
|
<a name="l00050"></a>00050
|
|
<a name="l00052"></a><a class="code" href="classstk_1_1Resonate.html#afebf784a302eb0043b4a453b0d1d852c">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#afebf784a302eb0043b4a453b0d1d852c" title="Initiate the envelope with a key-on event.">keyOn</a>( <span class="keywordtype">void</span> ) { adsr_.<a class="code" href="classstk_1_1ADSR.html#aad03e82009a20cfb49c1f04bae791631" title="Set target = 1, state = ADSR::ATTACK.">keyOn</a>(); };
|
|
<a name="l00053"></a>00053
|
|
<a name="l00055"></a><a class="code" href="classstk_1_1Resonate.html#a0008e1fdd7611b769b72b52c8bfb1e6a">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#a0008e1fdd7611b769b72b52c8bfb1e6a" title="Signal a key-off event to the envelope.">keyOff</a>( <span class="keywordtype">void</span> ) { adsr_.<a class="code" href="classstk_1_1ADSR.html#a9400e04b313ab8900a3ba9b693f448e6" title="Set target = 0, state = ADSR::RELEASE.">keyOff</a>(); };
|
|
<a name="l00056"></a>00056
|
|
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#a76bfadc70f4163f9767e7864d322d144" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
|
<a name="l00059"></a>00059
|
|
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#a0454a8e9d6ef3a2394b6c348edf0195f" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
|
<a name="l00062"></a>00062
|
|
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Resonate.html#af55feabf25f1f6f996c32574656ffd68" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
|
<a name="l00065"></a>00065
|
|
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
|
<a name="l00068"></a>00068
|
|
<a name="l00069"></a>00069 <span class="keyword">protected</span>:
|
|
<a name="l00070"></a>00070
|
|
<a name="l00071"></a>00071 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
|
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> filter_;
|
|
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
|
<a name="l00074"></a>00074 StkFloat poleFrequency_;
|
|
<a name="l00075"></a>00075 StkFloat poleRadius_;
|
|
<a name="l00076"></a>00076 StkFloat zeroFrequency_;
|
|
<a name="l00077"></a>00077 StkFloat zeroRadius_;
|
|
<a name="l00078"></a>00078
|
|
<a name="l00079"></a>00079 };
|
|
<a name="l00080"></a>00080
|
|
<a name="l00081"></a><a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98">00081</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98" title="Compute and return one output sample.">Resonate :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
|
<a name="l00082"></a>00082 {
|
|
<a name="l00083"></a>00083 lastFrame_[0] = filter_.<a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">tick</a>( noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>() );
|
|
<a name="l00084"></a>00084 lastFrame_[0] *= adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
|
<a name="l00085"></a>00085 <span class="keywordflow">return</span> lastFrame_[0];
|
|
<a name="l00086"></a>00086 }
|
|
<a name="l00087"></a>00087
|
|
<a name="l00088"></a>00088 } <span class="comment">// stk namespace</span>
|
|
<a name="l00089"></a>00089
|
|
<a name="l00090"></a>00090 <span class="preprocessor">#endif</span>
|
|
</pre></div></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>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|