mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
83 lines
6.6 KiB
HTML
83 lines
6.6 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.5.8 -->
|
|
<div class="navpath"><a class="el" href="dir_d499f4756a454d8a02faa5ebe57d576f.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>PercFlut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PERCFLUT_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PERCFLUT_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "FM.h"</span>
|
|
<a name="l00005"></a>00005
|
|
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
|
<a name="l00007"></a>00007
|
|
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
|
<a name="l00034"></a>00034 <span class="comment">/***************************************************/</span>
|
|
<a name="l00035"></a>00035
|
|
<a name="l00036"></a><a class="code" href="classstk_1_1PercFlut.html">00036</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PercFlut.html" title="STK percussive flute FM synthesis instrument.">PercFlut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a>
|
|
<a name="l00037"></a>00037 {
|
|
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
|
<a name="l00040"></a>00040
|
|
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1PercFlut.html#b51f05b79d818ed8ba80fd827a4839c2" title="Class constructor.">PercFlut</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00044"></a>00044
|
|
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1PercFlut.html#dd2a18e8835d665d505521e0298bd2f0" title="Class destructor.">~PercFlut</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00047"></a>00047
|
|
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PercFlut.html#24197fb4ae0bf806d8e3f6fe4eb5598c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
|
<a name="l00050"></a>00050
|
|
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PercFlut.html#7ebfc19d4c41482a699f43b2c06dc02d" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
|
<a name="l00053"></a>00053
|
|
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1PercFlut.html#c2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
|
<a name="l00056"></a>00056
|
|
<a name="l00057"></a>00057 <span class="keyword">protected</span>:
|
|
<a name="l00058"></a>00058
|
|
<a name="l00059"></a>00059 };
|
|
<a name="l00060"></a>00060
|
|
<a name="l00061"></a><a class="code" href="classstk_1_1PercFlut.html#c2b2958902c044413a1c7ff3bd0f8054">00061</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PercFlut.html#c2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">PercFlut :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
|
<a name="l00062"></a>00062 {
|
|
<a name="l00063"></a>00063 <span class="keyword">register</span> StkFloat temp;
|
|
<a name="l00064"></a>00064
|
|
<a name="l00065"></a>00065 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
|
<a name="l00066"></a>00066 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
|
<a name="l00067"></a>00067 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
|
<a name="l00068"></a>00068 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
|
<a name="l00069"></a>00069 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
|
<a name="l00070"></a>00070
|
|
<a name="l00071"></a>00071 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
|
<a name="l00072"></a>00072 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
|
<a name="l00073"></a>00073
|
|
<a name="l00074"></a>00074 twozero_.<a class="code" href="classstk_1_1TwoZero.html#cf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
|
<a name="l00075"></a>00075 waves_[2]->addPhaseOffset( temp );
|
|
<a name="l00076"></a>00076 temp = (1.0 - (control2_ * 0.5)) * gains_[2] * adsr_[2]-><a class="code" href="classstk_1_1PercFlut.html#c2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>() * waves_[2]->tick();
|
|
<a name="l00077"></a>00077
|
|
<a name="l00078"></a>00078 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
|
<a name="l00079"></a>00079 temp = temp * control1_;
|
|
<a name="l00080"></a>00080
|
|
<a name="l00081"></a>00081 waves_[0]->addPhaseOffset(temp);
|
|
<a name="l00082"></a>00082 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
|
<a name="l00083"></a>00083
|
|
<a name="l00084"></a>00084 lastFrame_[0] = temp * 0.5;
|
|
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|