mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
81 lines
6.4 KiB
HTML
81 lines
6.4 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>HevyMetl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_HEVYMETL_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_HEVYMETL_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="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
|
<a name="l00037"></a>00037
|
|
<a name="l00038"></a><a class="code" href="classstk_1_1HevyMetl.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1HevyMetl.html" title="STK heavy metal FM synthesis instrument.">HevyMetl</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="l00039"></a>00039 {
|
|
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
|
<a name="l00042"></a>00042
|
|
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1HevyMetl.html#61e000b4c2a8ba021e43e8074be44390" title="Class constructor.">HevyMetl</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00046"></a>00046
|
|
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1HevyMetl.html#03b76a27541928bf9e7d156f9709a8f0" title="Class destructor.">~HevyMetl</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00049"></a>00049
|
|
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1HevyMetl.html#a7401a5cb44a69edaad304aac41b6eda" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
|
<a name="l00052"></a>00052
|
|
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
|
<a name="l00055"></a>00055
|
|
<a name="l00056"></a>00056 <span class="keyword">protected</span>:
|
|
<a name="l00057"></a>00057
|
|
<a name="l00058"></a>00058 };
|
|
<a name="l00059"></a>00059
|
|
<a name="l00060"></a><a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7">00060</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
|
<a name="l00061"></a>00061 {
|
|
<a name="l00062"></a>00062 <span class="keyword">register</span> StkFloat temp;
|
|
<a name="l00063"></a>00063
|
|
<a name="l00064"></a>00064 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="l00065"></a>00065 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
|
<a name="l00066"></a>00066 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
|
<a name="l00067"></a>00067 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
|
<a name="l00068"></a>00068 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
|
<a name="l00069"></a>00069
|
|
<a name="l00070"></a>00070 temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
|
<a name="l00071"></a>00071 waves_[1]->addPhaseOffset( temp );
|
|
<a name="l00072"></a>00072
|
|
<a name="l00073"></a>00073 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#e9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
|
<a name="l00074"></a>00074 temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]-><a class="code" href="classstk_1_1HevyMetl.html#0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>() * waves_[3]->tick();
|
|
<a name="l00075"></a>00075 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="l00076"></a>00076
|
|
<a name="l00077"></a>00077 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
|
<a name="l00078"></a>00078 temp = temp * control1_;
|
|
<a name="l00079"></a>00079
|
|
<a name="l00080"></a>00080 waves_[0]->addPhaseOffset( temp );
|
|
<a name="l00081"></a>00081 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
|
<a name="l00082"></a>00082
|
|
<a name="l00083"></a>00083 lastFrame_[0] = temp * 0.5;
|
|
<a name="l00084"></a>00084 <span class="keywordflow">return</span> lastFrame_[0];
|
|
<a name="l00085"></a>00085 }
|
|
<a name="l00086"></a>00086
|
|
<a name="l00087"></a>00087 } <span class="comment">// stk namespace</span>
|
|
<a name="l00088"></a>00088
|
|
<a name="l00089"></a>00089 <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>
|