Release 4.4.0 tarball

This commit is contained in:
Gary Scavone
2013-09-29 23:44:33 +02:00
committed by Stephen Sinclair
parent 3706458166
commit d2ed001eb5
1427 changed files with 44061 additions and 39976 deletions

View File

@@ -8,80 +8,107 @@
<img src="princeton.gif"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="faq.html">FAQ</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.4.4 -->
<div class="nav">
<a class="el" href="dir_000000.html">include</a></div>
<h1>Modal.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/***************************************************/</span>
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <span class="preprocessor">#ifndef STK_MODAL_H</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODAL_H</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span>
<a name="l00017"></a>00017 <span class="preprocessor">#include "Instrmnt.h"</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include "Envelope.h"</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include "WaveLoop.h"</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include "SineWave.h"</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include "BiQuad.h"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "OnePole.h"</span>
<a name="l00023"></a>00023
<a name="l00024"></a><a class="code" href="classModal.html">00024</a> <span class="keyword">class </span><a class="code" href="classModal.html">Modal</a> : <span class="keyword">public</span> <a class="code" href="classInstrmnt.html">Instrmnt</a>
<a name="l00025"></a>00025 {
<a name="l00026"></a>00026 <span class="keyword">public</span>:
<a name="l00028"></a>00028
<a name="l00031"></a>00031 <a class="code" href="classModal.html#a0">Modal</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modes = 4 );
<a name="l00032"></a>00032
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <a class="code" href="classModal.html#a1">~Modal</a>();
<a name="l00035"></a>00035
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a2">clear</a>();
<a name="l00038"></a>00038
<a name="l00040"></a>00040 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModal.html#a3">setFrequency</a>(StkFloat frequency);
<a name="l00041"></a>00041
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a4">setRatioAndRadius</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modeIndex, StkFloat ratio, StkFloat radius);
<a name="l00044"></a>00044
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a5">setMasterGain</a>(StkFloat aGain);
<a name="l00047"></a>00047
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a6">setDirectGain</a>(StkFloat aGain);
<a name="l00050"></a>00050
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a7">setModeGain</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modeIndex, StkFloat gain);
<a name="l00053"></a>00053
<a name="l00055"></a>00055 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModal.html#a8">strike</a>(StkFloat amplitude);
<a name="l00056"></a>00056
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a9">damp</a>(StkFloat amplitude);
<a name="l00059"></a>00059
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a10">noteOn</a>(StkFloat frequency, StkFloat amplitude);
<a name="l00062"></a>00062
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classModal.html#a11">noteOff</a>(StkFloat amplitude);
<a name="l00065"></a>00065
<a name="l00067"></a>00067 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classModal.html#a12">controlChange</a>(<span class="keywordtype">int</span> number, StkFloat value) = 0;
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="keyword">protected</span>:
<!-- Generated by Doxygen 1.5.8 -->
<div class="navpath"><a class="el" href="dir_d499f4756a454d8a02faa5ebe57d576f.html">include</a>
</div>
<div class="contents">
<h1>Modal.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MODAL_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODAL_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 "Envelope.h"</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileLoop.h"</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include "OnePole.h"</span>
<a name="l00010"></a>00010
<a name="l00011"></a>00011 <span class="keyword">namespace </span>stk {
<a name="l00012"></a>00012
<a name="l00013"></a>00013 <span class="comment">/***************************************************/</span>
<a name="l00024"></a>00024 <span class="comment">/***************************************************/</span>
<a name="l00025"></a>00025
<a name="l00026"></a><a class="code" href="classstk_1_1Modal.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Modal.html" title="STK resonance model abstract base class.">Modal</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
<a name="l00027"></a>00027 {
<a name="l00028"></a>00028 <span class="keyword">public</span>:
<a name="l00030"></a>00030
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1Modal.html#f6bfea135e80abb5537e62cf099c989a" title="Class constructor, taking the desired number of modes to create.">Modal</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modes = 4 );
<a name="l00034"></a>00034
<a name="l00036"></a>00036 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1Modal.html#7f45379ae10495b7a864cade0063705a" title="Class destructor.">~Modal</a>( <span class="keywordtype">void</span> );
<a name="l00037"></a>00037
<a name="l00039"></a>00039 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#f064dc6ee4290fd51b4a6dc8a1f0909d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
<a name="l00040"></a>00040
<a name="l00042"></a>00042 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#503092926e66667227bb46312a82a264" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
<a name="l00043"></a>00043
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#7e4f9a875e60485d07d50386ff63117f" title="Set the ratio and radius for a specified mode filter.">setRatioAndRadius</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modeIndex, StkFloat ratio, StkFloat radius );
<a name="l00046"></a>00046
<a name="l00048"></a><a class="code" href="classstk_1_1Modal.html#6e8d79358a5024b2e9a6c6f7c69a43c1">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#6e8d79358a5024b2e9a6c6f7c69a43c1" title="Set the master gain.">setMasterGain</a>( StkFloat aGain ) { masterGain_ = aGain; };
<a name="l00049"></a>00049
<a name="l00051"></a><a class="code" href="classstk_1_1Modal.html#70006135da2ecdc46eff4156504d94e1">00051</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#70006135da2ecdc46eff4156504d94e1" title="Set the direct gain.">setDirectGain</a>( StkFloat aGain ) { directGain_ = aGain; };
<a name="l00052"></a>00052
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#08bdfedf10d00dcf19e82809926eab2f" title="Set the gain for a specified mode filter.">setModeGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modeIndex, StkFloat gain );
<a name="l00055"></a>00055
<a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#b3bac00a47fa6fef70cf3ea442e9b121" title="Initiate a strike with the given amplitude (0.0 - 1.0).">strike</a>( StkFloat amplitude );
<a name="l00058"></a>00058
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#1884c49b76ec8b902f22d50e26a7e365" title="Damp modes with a given decay factor (0.0 - 1.0).">damp</a>( StkFloat amplitude );
<a name="l00061"></a>00061
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#44ce41e8e24e591f382914d00a259c7f" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
<a name="l00064"></a>00064
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#3483dafe33fa37e98781279810ea808f" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
<a name="l00067"></a>00067
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#9fab49ec164852c381758f5d333f8891" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value ) = 0;
<a name="l00070"></a>00070
<a name="l00071"></a>00071 StkFloat computeSample( <span class="keywordtype">void</span> );
<a name="l00072"></a>00072
<a name="l00073"></a>00073 <a class="code" href="classEnvelope.html">Envelope</a> envelope_;
<a name="l00074"></a>00074 <a class="code" href="classFileWvIn.html">FileWvIn</a> *wave_;
<a name="l00075"></a>00075 <a class="code" href="classBiQuad.html">BiQuad</a> **filters_;
<a name="l00076"></a>00076 <a class="code" href="classOnePole.html">OnePole</a> onepole_;
<a name="l00077"></a>00077 <a class="code" href="classSineWave.html">SineWave</a> vibrato_;
<a name="l00078"></a>00078
<a name="l00079"></a>00079 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nModes_;
<a name="l00080"></a>00080 std::vector&lt;StkFloat&gt; ratios_;
<a name="l00081"></a>00081 std::vector&lt;StkFloat&gt; radii_;
<a name="l00082"></a>00082
<a name="l00083"></a>00083 StkFloat vibratoGain_;
<a name="l00084"></a>00084 StkFloat masterGain_;
<a name="l00085"></a>00085 StkFloat directGain_;
<a name="l00086"></a>00086 StkFloat stickHardness_;
<a name="l00087"></a>00087 StkFloat strikePosition_;
<a name="l00088"></a>00088 StkFloat baseFrequency_;
<a name="l00089"></a>00089 };
<a name="l00090"></a>00090
<a name="l00091"></a>00091 <span class="preprocessor">#endif</span>
</pre></div><HR>
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
<a name="l00073"></a>00073
<a name="l00074"></a>00074 <span class="keyword">protected</span>:
<a name="l00075"></a>00075
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *wave_;
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> **filters_;
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> onepole_;
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
<a name="l00081"></a>00081
<a name="l00082"></a>00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nModes_;
<a name="l00083"></a>00083 std::vector&lt;StkFloat&gt; ratios_;
<a name="l00084"></a>00084 std::vector&lt;StkFloat&gt; radii_;
<a name="l00085"></a>00085
<a name="l00086"></a>00086 StkFloat vibratoGain_;
<a name="l00087"></a>00087 StkFloat masterGain_;
<a name="l00088"></a>00088 StkFloat directGain_;
<a name="l00089"></a>00089 StkFloat stickHardness_;
<a name="l00090"></a>00090 StkFloat strikePosition_;
<a name="l00091"></a>00091 StkFloat baseFrequency_;
<a name="l00092"></a>00092 };
<a name="l00093"></a>00093
<a name="l00094"></a><a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890">00094</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">Modal :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
<a name="l00095"></a>00095 {
<a name="l00096"></a>00096 StkFloat temp = masterGain_ * onepole_.<a class="code" href="classstk_1_1OnePole.html#3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( wave_-&gt;<a class="code" href="classstk_1_1FileWvIn.html#da668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * envelope_.<a class="code" href="classstk_1_1Envelope.html#8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>() );
<a name="l00097"></a>00097
<a name="l00098"></a>00098 StkFloat temp2 = 0.0;
<a name="l00099"></a>00099 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;nModes_; i++ )
<a name="l00100"></a>00100 temp2 += filters_[i]-&gt;<a class="code" href="classstk_1_1Modal.html#c1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>(temp);
<a name="l00101"></a>00101
<a name="l00102"></a>00102 temp2 -= temp2 * directGain_;
<a name="l00103"></a>00103 temp2 += directGain_ * temp;
<a name="l00104"></a>00104
<a name="l00105"></a>00105 <span class="keywordflow">if</span> ( vibratoGain_ != 0.0 ) {
<a name="l00106"></a>00106 <span class="comment">// Calculate AM and apply to master out</span>
<a name="l00107"></a>00107 temp = 1.0 + ( vibrato_.<a class="code" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * vibratoGain_ );
<a name="l00108"></a>00108 temp2 = temp * temp2;
<a name="l00109"></a>00109 }
<a name="l00110"></a>00110
<a name="l00111"></a>00111 lastFrame_[0] = temp2;
<a name="l00112"></a>00112 <span class="keywordflow">return</span> lastFrame_[0];
<a name="l00113"></a>00113 }
<a name="l00114"></a>00114
<a name="l00115"></a>00115 } <span class="comment">// stk namespace</span>
<a name="l00116"></a>00116
<a name="l00117"></a>00117 <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>&copy;1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
<tr><td>&copy;1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>