mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
78 lines
6.1 KiB
HTML
78 lines
6.1 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_c28bfe24b93fcab464ea84f988cb34ef.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>TubeBell.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TUBEBELL_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TUBEBELL_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="l00038"></a>00038 <span class="comment">/***************************************************/</span>
|
|
<a name="l00039"></a>00039
|
|
<a name="l00040"></a><a class="code" href="classstk_1_1TubeBell.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1TubeBell.html" title="STK tubular bell (orchestral chime) FM synthesis instrument.">TubeBell</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="l00041"></a>00041 {
|
|
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
|
<a name="l00044"></a>00044
|
|
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1TubeBell.html#7b5de1d681fcb5c2899094dc1ffe0453" title="Class constructor.">TubeBell</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00048"></a>00048
|
|
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1TubeBell.html#b841ecb52b7be3b896d92b968364b529" title="Class destructor.">~TubeBell</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00051"></a>00051
|
|
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TubeBell.html#a141536c51b4918dd5fae222e5cb6aa3" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
|
<a name="l00054"></a>00054
|
|
<a name="l00056"></a>00056 StkFloat <a class="code" href="classstk_1_1TubeBell.html#fa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
|
<a name="l00057"></a>00057
|
|
<a name="l00058"></a>00058 <span class="keyword">protected</span>:
|
|
<a name="l00059"></a>00059
|
|
<a name="l00060"></a>00060 };
|
|
<a name="l00061"></a>00061
|
|
<a name="l00062"></a><a class="code" href="classstk_1_1TubeBell.html#fa7422b2a7361f2ebe60ebff887ef36f">00062</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1TubeBell.html#fa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">TubeBell :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
|
<a name="l00063"></a>00063 {
|
|
<a name="l00064"></a>00064 StkFloat temp, temp2;
|
|
<a name="l00065"></a>00065
|
|
<a name="l00066"></a>00066 temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
|
<a name="l00067"></a>00067 temp = temp * control1_;
|
|
<a name="l00068"></a>00068
|
|
<a name="l00069"></a>00069 waves_[0]->addPhaseOffset( temp );
|
|
<a name="l00070"></a>00070 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
|
<a name="l00071"></a>00071 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
|
<a name="l00072"></a>00072 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="l00073"></a>00073
|
|
<a name="l00074"></a>00074 waves_[2]->addPhaseOffset( temp );
|
|
<a name="l00075"></a>00075 temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]-><a class="code" href="classstk_1_1TubeBell.html#fa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">tick</a>() * waves_[0]->tick();
|
|
<a name="l00076"></a>00076 temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
|
<a name="l00077"></a>00077
|
|
<a name="l00078"></a>00078 <span class="comment">// Calculate amplitude modulation and apply it to output.</span>
|
|
<a name="l00079"></a>00079 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_;
|
|
<a name="l00080"></a>00080 temp = temp * (1.0 + temp2);
|
|
<a name="l00081"></a>00081
|
|
<a name="l00082"></a>00082 lastFrame_[0] = temp * 0.5;
|
|
<a name="l00083"></a>00083 <span class="keywordflow">return</span> lastFrame_[0];
|
|
<a name="l00084"></a>00084 }
|
|
<a name="l00085"></a>00085
|
|
<a name="l00086"></a>00086 } <span class="comment">// stk namespace</span>
|
|
<a name="l00087"></a>00087
|
|
<a name="l00088"></a>00088 <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>
|