mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Compare commits
25 Commits
270edc855f
...
4.4.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f13d5bb3cd | ||
|
|
cfdfe7736a | ||
|
|
7fcf920d3e | ||
|
|
c37de52787 | ||
|
|
5a8a65870f | ||
|
|
9af41126cb | ||
|
|
d2ed001eb5 | ||
|
|
3706458166 | ||
|
|
c92cf7468d | ||
|
|
e54b0cefab | ||
|
|
1a8403e203 | ||
|
|
554a74374b | ||
|
|
21b93795e7 | ||
|
|
11cf5faa0a | ||
|
|
de344668dd | ||
|
|
fe20fe92a2 | ||
|
|
e11bff2fe8 | ||
|
|
503ed3cc9f | ||
|
|
5d63b50e85 | ||
|
|
d12ef806ac | ||
|
|
ffce5357c6 | ||
|
|
b39c0bb101 | ||
|
|
f25eb5c3d7 | ||
|
|
71e5c027fb | ||
|
|
43dcd5775a |
164
doc/html/ADSR_8h_source.html
Normal file
164
doc/html/ADSR_8h_source.html
Normal file
@@ -0,0 +1,164 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ADSR.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ADSR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ADSR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a><a class="code" href="namespacestk.html">00006</a> <span class="keyword">namespace </span>stk {
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1ADSR.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <span class="keyword">enum</span> {
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">00029</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">ATTACK</a>,
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">00030</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>,
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">00031</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>,
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">00032</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">RELEASE</a>,
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa1ed3238253daecbdba14da71759392d8">00033</a> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa1ed3238253daecbdba14da71759392d8">IDLE</a>
|
||||
<a name="l00034"></a>00034 };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1ADSR.html#ac7473272021307b0dcf1ef602143e144" title="Default constructor.">ADSR</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1ADSR.html#a714f0b9deb325050eba819bc1fe22127" title="Class destructor.">~ADSR</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_1ADSR.html#aad03e82009a20cfb49c1f04bae791631" title="Set target = 1, state = ADSR::ATTACK.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a9400e04b313ab8900a3ba9b693f448e6" title="Set target = 0, state = ADSR::RELEASE.">keyOff</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_1ADSR.html#aff18347235fd52ce307c4b5de18a9c62" title="Set the attack rate.">setAttackRate</a>( StkFloat rate );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#ae0af300e39f83f79776c04a3e83a85b1" title="Set the target value for the attack (default = 1.0).">setAttackTarget</a>( StkFloat target );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a285f500b1e149aed48dba2a155b95cdd" title="Set the decay rate.">setDecayRate</a>( StkFloat rate );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a85138fb6bbcc7b7cd85ec8449d68f7d8" title="Set the sustain level.">setSustainLevel</a>( StkFloat level );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a29da04231df73c2968c0e9387b43be6e" title="Set the release rate.">setReleaseRate</a>( StkFloat rate );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a48885319b8175cd4d6312fdf7980f116" title="Set the attack rate based on a time duration.">setAttackTime</a>( StkFloat time );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a450703c45384ae27eb766551843ce82d" title="Set the decay rate based on a time duration (seconds).">setDecayTime</a>( StkFloat time );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a91c14442557cb65286a327f8b297237a" title="Set the release rate based on a time duration (seconds).">setReleaseTime</a>( StkFloat time );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a3567b02a0e8ab82d18eb949d362f9708" title="Set sustain level and attack, decay, and release time durations.">setAllTimes</a>( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#a428eebd510e464ccd7bb4e5728f80d63" title="Set a sustain target value and attack or decay from current value to target.">setTarget</a>( StkFloat target );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a><a class="code" href="classstk_1_1ADSR.html#a87f9918cfa4104a841dc5b44f26f8904">00079</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1ADSR.html#a87f9918cfa4104a841dc5b44f26f8904" title="Return the current envelope state (ATTACK, DECAY, SUSTAIN, RELEASE, IDLE).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ADSR.html#aa99bf5fca3885bf8d99a3edc4072a4b5" title="Set to state = ADSR::SUSTAIN with current and target values of value.">setValue</a>( StkFloat value );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a><a class="code" href="classstk_1_1ADSR.html#aedbcb85346c354139f139b3232f36f39">00085</a> StkFloat <a class="code" href="classstk_1_1ADSR.html#aedbcb85346c354139f139b3232f36f39" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00105"></a>00105 StkFloat value_;
|
||||
<a name="l00106"></a>00106 StkFloat target_;
|
||||
<a name="l00107"></a>00107 StkFloat attackRate_;
|
||||
<a name="l00108"></a>00108 StkFloat decayRate_;
|
||||
<a name="l00109"></a>00109 StkFloat releaseRate_;
|
||||
<a name="l00110"></a>00110 StkFloat releaseTime_;
|
||||
<a name="l00111"></a>00111 StkFloat sustainLevel_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">switch</span> ( state_ ) {
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa9518c737b76795fa49f997c09e074c8e">ATTACK</a>:
|
||||
<a name="l00119"></a>00119 value_ += attackRate_;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00121"></a>00121 value_ = target_;
|
||||
<a name="l00122"></a>00122 target_ = sustainLevel_;
|
||||
<a name="l00123"></a>00123 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125 lastFrame_[0] = value_;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">break</span>;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa75e1deeb861fe2989250b1977018cacf">DECAY</a>:
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( value_ > sustainLevel_ ) {
|
||||
<a name="l00130"></a>00130 value_ -= decayRate_;
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">if</span> ( value_ <= sustainLevel_ ) {
|
||||
<a name="l00132"></a>00132 value_ = sustainLevel_;
|
||||
<a name="l00133"></a>00133 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">else</span> {
|
||||
<a name="l00137"></a>00137 value_ += decayRate_; <span class="comment">// attack target < sustain level</span>
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">if</span> ( value_ >= sustainLevel_ ) {
|
||||
<a name="l00139"></a>00139 value_ = sustainLevel_;
|
||||
<a name="l00140"></a>00140 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa139dc35648a28ddc99a7a606e185f6ad">SUSTAIN</a>;
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143 lastFrame_[0] = value_;
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">break</span>;
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">case</span> <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa7efc189b0b53e581201fd64f357a1756">RELEASE</a>:
|
||||
<a name="l00147"></a>00147 value_ -= releaseRate_;
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">if</span> ( value_ <= 0.0 ) {
|
||||
<a name="l00149"></a>00149 value_ = 0.0;
|
||||
<a name="l00150"></a>00150 state_ = <a class="code" href="classstk_1_1ADSR.html#ae1cdd1f2886d69a76fcd5b1e0e9154baa1ed3238253daecbdba14da71759392d8">IDLE</a>;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152 lastFrame_[0] = value_;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a><a class="code" href="classstk_1_1ADSR.html#a97a617c65e62aadb4f88bd10cf437a6a">00159</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00160"></a>00160 {
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00162"></a>00162 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00163"></a>00163 oStream_ << <span class="stringliteral">"ADSR::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00164"></a>00164 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166 <span class="preprocessor">#endif</span>
|
||||
<a name="l00167"></a>00167 <span class="preprocessor"></span>
|
||||
<a name="l00168"></a>00168 StkFloat *samples = &frames[channel];
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00170"></a>00170 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00171"></a>00171 *samples = <a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">ADSR::tick</a>();
|
||||
<a name="l00172"></a>00172
|
||||
<a name="l00173"></a>00173 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00174"></a>00174 }
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00176"></a>00176 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a>00178 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
doc/html/Asymp_8h_source.html
Normal file
124
doc/html/Asymp_8h_source.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Asymp.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ASYMP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ASYMP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.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="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a>00033 <span class="keyword">const</span> StkFloat TARGET_THRESHOLD = 0.000001;
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Asymp.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Asymp.html" title="STK asymptotic curve envelope class.">Asymp</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Asymp.html#ad8ea9fc5621a1d8b81001d459de265a0" title="Default constructor.">Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Asymp.html#ad869abbd938c263a2c177de636f5a57c" title="Class destructor.">~Asymp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a51f0aad846eb6bda4c20eb63534786e2" title="Set target = 1.">keyOn</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_1Asymp.html#a082e765dc3bd6b452e92b602af7a1042" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#aebd8ebaf6f6c9570d3ee78e1bcbbcbd2" title="Set the asymptotic rate via the time factor tau (must be &gt; 0).">setTau</a>( StkFloat tau );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#aca998e9c4ae86b4958da59fc9433268c" title="Set the asymptotic rate based on a time duration (must be &gt; 0).">setTime</a>( StkFloat time );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#afa6fcf4bf3060c0c6092701e409d5fbf" title="Set the asymptotic rate such that the target value is perceptually reached (to within...">setT60</a>( StkFloat t60 );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a7b0f7025ba5f268f1e5ce097b209f0ec" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Asymp.html#a81881bb8aca615f69bbbfd56267f971c" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Asymp.html#aaba01ef0ac1a493a14a73c3b29259bde">00073</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Asymp.html#aaba01ef0ac1a493a14a73c3b29259bde" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Asymp.html#aeb868c171e07206e2d5d30f8ce8f4436">00076</a> StkFloat <a class="code" href="classstk_1_1Asymp.html#aeb868c171e07206e2d5d30f8ce8f4436" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 StkFloat value_;
|
||||
<a name="l00096"></a>00096 StkFloat target_;
|
||||
<a name="l00097"></a>00097 StkFloat factor_;
|
||||
<a name="l00098"></a>00098 StkFloat constant_;
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00100"></a>00100 };
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a><a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e">00102</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00103"></a>00103 {
|
||||
<a name="l00104"></a>00104 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 value_ = factor_ * value_ + constant_;
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Check threshold.</span>
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( target_ - value_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00111"></a>00111 value_ = target_;
|
||||
<a name="l00112"></a>00112 state_ = 0;
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 }
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">else</span> {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">if</span> ( value_ - target_ <= TARGET_THRESHOLD ) {
|
||||
<a name="l00117"></a>00117 value_ = target_;
|
||||
<a name="l00118"></a>00118 state_ = 0;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = value_;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1Asymp.html#a2647bc013816f026915b1e92ddd6a322">00127</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00128"></a>00128 {
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00130"></a>00130 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00131"></a>00131 oStream_ << <span class="stringliteral">"Asymp::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00132"></a>00132 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#endif</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span>
|
||||
<a name="l00136"></a>00136 StkFloat *samples = &frames[channel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00139"></a>00139 *samples = <a class="code" href="classstk_1_1Asymp.html#a64df3b44aa1033b642d7a8a93659580e" title="Compute and return one output sample.">Asymp::tick</a>();
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
129
doc/html/BandedWG_8h_source.html
Normal file
129
doc/html/BandedWG_8h_source.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BandedWG.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BANDEDWG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BANDEDWG_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 "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_BANDED_MODES = 20;
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1BandedWG.html">00045</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BandedWG.html" title="Banded waveguide modeling class.">BandedWG</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00046"></a>00046 {
|
||||
<a name="l00047"></a>00047 <span class="keyword">public</span>:
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BandedWG.html#ad449f248adaa49344c2bd25be4a7872d" title="Class constructor.">BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BandedWG.html#ac4044055c28bad672c9537b985d18289" title="Class destructor.">~BandedWG</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a182dbf5d75aebf5714bd6df15b0df90c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a4394ee4cd1c84a8b3f92713e60715c4d" title="Set strike position (0.0 - 1.0).">setStrikePosition</a>( StkFloat position );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#ab1e3a367eef86e6cb372b4ee232e1804" title="Select a preset.">setPreset</a>( <span class="keywordtype">int</span> preset );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#acf104d4ed663b5f0cd034c8025f4d420" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a37b20c2554e7100241a99758f5a4433e" title="Apply bow velocity/pressure to instrument with given amplitude and rate of increase...">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#aa14786c32af030311e2118db3b68a892" title="Decrease bow velocity/breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a271573afaa2dc655446482bad6745cc1" title="Pluck the instrument with given amplitude.">pluck</a>( StkFloat amp );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a8f334ae49b7baf561d74a0b6ec3c4f9a" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#ac9c3c3ec0e821b1a080774bb55d3b881" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BandedWG.html#a16baac1cc6612332d6d0aa40a661c137" 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="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 StkFloat <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keyword">protected</span>:
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">bool</span> doPluck_;
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> trackVelocity_;
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">int</span> presetModes_;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bandpass_[MAX_BANDED_MODES];
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delay_[MAX_BANDED_MODES];
|
||||
<a name="l00107"></a>00107 StkFloat maxVelocity_;
|
||||
<a name="l00108"></a>00108 StkFloat modes_[MAX_BANDED_MODES];
|
||||
<a name="l00109"></a>00109 StkFloat frequency_;
|
||||
<a name="l00110"></a>00110 StkFloat baseGain_;
|
||||
<a name="l00111"></a>00111 StkFloat gains_[MAX_BANDED_MODES];
|
||||
<a name="l00112"></a>00112 StkFloat basegains_[MAX_BANDED_MODES];
|
||||
<a name="l00113"></a>00113 StkFloat excitation_[MAX_BANDED_MODES];
|
||||
<a name="l00114"></a>00114 StkFloat integrationConstant_;
|
||||
<a name="l00115"></a>00115 StkFloat velocityInput_;
|
||||
<a name="l00116"></a>00116 StkFloat bowVelocity_;
|
||||
<a name="l00117"></a>00117 StkFloat bowTarget_;
|
||||
<a name="l00118"></a>00118 StkFloat bowPosition_;
|
||||
<a name="l00119"></a>00119 StkFloat strikeAmp_;
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">int</span> strikePosition_;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 };
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1BandedWG.html#a6c2ebb66862b173c4835add6847801c9">00124</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">BandedWG :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00127"></a>00127 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00128"></a>00128 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00129"></a>00129 oStream_ << <span class="stringliteral">"BandedWG::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00130"></a>00130 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132 <span class="preprocessor">#endif</span>
|
||||
<a name="l00133"></a>00133 <span class="preprocessor"></span>
|
||||
<a name="l00134"></a>00134 StkFloat *samples = &frames[channel];
|
||||
<a name="l00135"></a>00135 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00138"></a>00138 *samples++ = <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">else</span> {
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00142"></a>00142 *samples++ = <a class="code" href="classstk_1_1BandedWG.html#a44f37146d33354afb085806bd8340497" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00144"></a>00144 *samples++ = lastFrame_[j];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/BeeThree_8h_source.html
Normal file
107
doc/html/BeeThree_8h_source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BeeThree.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BEETHREE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BEETHREE_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="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BeeThree.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BeeThree.html" title="STK Hammond-oid organ FM synthesis instrument.">BeeThree</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="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BeeThree.html#ab4534210b85a2c4798bf1c88b348c20a" title="Class constructor.">BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1BeeThree.html#af2a0c982731438cf6200b3e5642a288d" title="Class destructor.">~BeeThree</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BeeThree.html#a480c0fe8d4c2df9c00b82b192dd7eae4" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="keyword">protected</span>:
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7">00074</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00075"></a>00075 {
|
||||
<a name="l00076"></a>00076 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">if</span> ( modDepth_ > 0.0 ) {
|
||||
<a name="l00079"></a>00079 temp = 1.0 + ( modDepth_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * 0.1 );
|
||||
<a name="l00080"></a>00080 waves_[0]->setFrequency( baseFrequency_ * temp * ratios_[0] );
|
||||
<a name="l00081"></a>00081 waves_[1]->setFrequency( baseFrequency_ * temp * ratios_[1] );
|
||||
<a name="l00082"></a>00082 waves_[2]->setFrequency( baseFrequency_ * temp * ratios_[2] );
|
||||
<a name="l00083"></a>00083 waves_[3]->setFrequency( baseFrequency_ * temp * ratios_[3] );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00087"></a>00087 temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00088"></a>00088 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00091"></a>00091 temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00092"></a>00092 temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = temp * 0.125;
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1BeeThree.html#a30520efff3fac0674d3c7ab95ac35999">00098</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">BeeThree :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"BeeThree::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00112"></a>00112 *samples++ = <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">else</span> {
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00116"></a>00116 *samples++ = <a class="code" href="classstk_1_1BeeThree.html#a4649b9471bde3b978c20fcafcbef0fc7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00118"></a>00118 *samples++ = lastFrame_[j];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
doc/html/BiQuad_8h_source.html
Normal file
148
doc/html/BiQuad_8h_source.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BiQuad.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BIQUAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BIQUAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1BiQuad.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1BiQuad.html#a91aab9d1b4833e156edcf59cbe276e3f" title="Default constructor creates a second-order pass-through filter.">BiQuad</a>();
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1BiQuad.html#ad7e81be1c4e5c5ab69474f6df2610984" title="Class destructor.">~BiQuad</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BiQuad.html#aab468cd1aa79b95442b15bb04d8bb211">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#aab468cd1aa79b95442b15bb04d8bb211" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#aeed58196cf798f664cddbb9a8564c7b5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat b2, StkFloat a1, StkFloat a2, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1BiQuad.html#a26ee25d08116b20f326001166f087853">00037</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a26ee25d08116b20f326001166f087853" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1BiQuad.html#add364ed410b3ed2a2b29b8a5fea127c8">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#add364ed410b3ed2a2b29b8a5fea127c8" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1BiQuad.html#a208a654dd3393ed0b2b86ad56d9cf3e1">00043</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a208a654dd3393ed0b2b86ad56d9cf3e1" title="Set the b[2] coefficient value.">setB2</a>( StkFloat b2 ) { b_[2] = b2; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a><a class="code" href="classstk_1_1BiQuad.html#a1c9799e47163fe8a59fd85196c089cb3">00046</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a1c9799e47163fe8a59fd85196c089cb3" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1BiQuad.html#ae28afd560df11435ea54f128d23b9383">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ae28afd560df11435ea54f128d23b9383" title="Set the a[2] coefficient value.">setA2</a>( StkFloat a2 ) { a_[2] = a2; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a55aaa01fd4156f1fac1168f526e3d969" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius, <span class="keywordtype">bool</span> normalize = <span class="keyword">false</span> );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#ae10a26fc319ba357bc92df4e528c2d8f" title="Set the filter coefficients for a notch at frequency (in Hz).">setNotch</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BiQuad.html#a28881f5876ce5bdcc846367cca9363f7" title="Sets the filter zeroes for equal resonance gain.">setEqualGainZeroes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a><a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063">00087</a> StkFloat <a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <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>( StkFloat input );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <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>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00112"></a>00112 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <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>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="keyword">protected</span>:
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00117"></a>00117 };
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a><a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635">00119</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( StkFloat input )
|
||||
<a name="l00120"></a>00120 {
|
||||
<a name="l00121"></a>00121 inputs_[0] = gain_ * input;
|
||||
<a name="l00122"></a>00122 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00123"></a>00123 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00124"></a>00124 inputs_[2] = inputs_[1];
|
||||
<a name="l00125"></a>00125 inputs_[1] = inputs_[0];
|
||||
<a name="l00126"></a>00126 outputs_[2] = outputs_[1];
|
||||
<a name="l00127"></a>00127 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a><a class="code" href="classstk_1_1BiQuad.html#af903e41217838470a5f267a20b905a12">00132</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00133"></a>00133 {
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 oStream_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00137"></a>00137 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></span>
|
||||
<a name="l00141"></a>00141 StkFloat *samples = &frames[channel];
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00144"></a>00144 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00145"></a>00145 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00146"></a>00146 *samples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00147"></a>00147 inputs_[2] = inputs_[1];
|
||||
<a name="l00148"></a>00148 inputs_[1] = inputs_[0];
|
||||
<a name="l00149"></a>00149 outputs_[2] = outputs_[1];
|
||||
<a name="l00150"></a>00150 outputs_[1] = *samples;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a><a class="code" href="classstk_1_1BiQuad.html#ac9836f0e074ea9516727f27eb9b411aa">00157</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BiQuad.html#a648086962c3cddcaa09c46a002c3e635" title="Input one sample to the filter and return a reference to one output.">BiQuad :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00158"></a>00158 {
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00160"></a>00160 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00161"></a>00161 oStream_ << <span class="stringliteral">"BiQuad::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00162"></a>00162 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164 <span class="preprocessor">#endif</span>
|
||||
<a name="l00165"></a>00165 <span class="preprocessor"></span>
|
||||
<a name="l00166"></a>00166 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00167"></a>00167 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00170"></a>00170 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00171"></a>00171 *oSamples = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00172"></a>00172 *oSamples -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00173"></a>00173 inputs_[2] = inputs_[1];
|
||||
<a name="l00174"></a>00174 inputs_[1] = inputs_[0];
|
||||
<a name="l00175"></a>00175 outputs_[2] = outputs_[1];
|
||||
<a name="l00176"></a>00176 outputs_[1] = *oSamples;
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00181"></a>00181 }
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00184"></a>00184
|
||||
<a name="l00185"></a>00185 <span class="preprocessor">#endif</span>
|
||||
<a name="l00186"></a>00186 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
129
doc/html/BlitSaw_8h_source.html
Normal file
129
doc/html/BlitSaw_8h_source.html
Normal file
@@ -0,0 +1,129 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSaw.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSAW_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSAW_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1BlitSaw.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSaw.html" title="STK band-limited sawtooth wave class.">BlitSaw</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1BlitSaw.html#a8a245ef05cc58c521edaded5c6cdd5ee" title="Class constructor.">BlitSaw</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1BlitSaw.html#a24cd2cc9852ce73252a99f7eff63879b" title="Class destructor.">~BlitSaw</a>();
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#a3010cf9a0905368b857df2d332968036" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#afa6f1103a61221eebf5f49f3a7df4145" title="Set the sawtooth oscillator rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSaw.html#a8abd2b9a5b8d26926a383c1e56605545" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1BlitSaw.html#a254758ecd4166cc4e7d6fced5650a198">00062</a> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a254758ecd4166cc4e7d6fced5650a198" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 <span class="keyword">protected</span>:
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00083"></a>00083 StkFloat rate_;
|
||||
<a name="l00084"></a>00084 StkFloat phase_;
|
||||
<a name="l00085"></a>00085 StkFloat p_;
|
||||
<a name="l00086"></a>00086 StkFloat C2_;
|
||||
<a name="l00087"></a>00087 StkFloat a_;
|
||||
<a name="l00088"></a>00088 StkFloat state_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="comment">// The code below implements the BLIT algorithm of Stilson and</span>
|
||||
<a name="l00095"></a>00095 <span class="comment">// Smith, followed by a summation and filtering operation to produce</span>
|
||||
<a name="l00096"></a>00096 <span class="comment">// a sawtooth waveform. After experimenting with various approaches</span>
|
||||
<a name="l00097"></a>00097 <span class="comment">// to calculate the average value of the BLIT over one period, I</span>
|
||||
<a name="l00098"></a>00098 <span class="comment">// found that an estimate of C2_ = 1.0 / period (in samples) worked</span>
|
||||
<a name="l00099"></a>00099 <span class="comment">// most consistently. A "leaky integrator" is then applied to the</span>
|
||||
<a name="l00100"></a>00100 <span class="comment">// difference of the BLIT output and C2_. (GPS - 1 October 2005)</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// A fully optimized version of this code would replace the two sin </span>
|
||||
<a name="l00103"></a>00103 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00104"></a>00104 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// not been made here.</span>
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Avoid a divide by zero, or use of a denormalized divisor </span>
|
||||
<a name="l00109"></a>00109 <span class="comment">// at the sinc peak, which has a limiting value of m_ / p_.</span>
|
||||
<a name="l00110"></a>00110 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( fabs(denominator) <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00112"></a>00112 tmp = a_;
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">else</span> {
|
||||
<a name="l00114"></a>00114 tmp = sin( m_ * phase_ );
|
||||
<a name="l00115"></a>00115 tmp /= p_ * denominator;
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 tmp += state_ - C2_;
|
||||
<a name="l00119"></a>00119 state_ = tmp * 0.995;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 phase_ += rate_;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 lastFrame_[0] = tmp;
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classstk_1_1BlitSaw.html#ab53f6ba99ef5c4f8982f6c0f07bf2e1d">00128</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00131"></a>00131 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00132"></a>00132 oStream_ << <span class="stringliteral">"BlitSaw::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00133"></a>00133 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00141"></a>00141 *samples = <a class="code" href="classstk_1_1BlitSaw.html#a03536a1f1823ea41649b4a62ba98007c" title="Compute and return one output sample.">BlitSaw::tick</a>();
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BlitSquare_8h_source.html
Normal file
134
doc/html/BlitSquare_8h_source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlitSquare.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLITSQUARE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLITSQUARE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BlitSquare.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlitSquare.html" title="STK band-limited square wave class.">BlitSquare</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1BlitSquare.html#a2cb3aee415a6ee75fa85b01e4e85d70b" title="Default constructor that initializes BLIT frequency to 220 Hz.">BlitSquare</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1BlitSquare.html#a4bc6e424ca1631f353f55846084634ef" title="Class destructor.">~BlitSquare</a>();
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#a8f6dbe07d7f64b24cc9a41f6208dd6c4" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1BlitSquare.html#aeface58980a3ec865131f3cad59bbbef">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#aeface58980a3ec865131f3cad59bbbef" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1BlitSquare.html#abbda8cb84bcd36fc6d96130e9832a6af">00064</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#abbda8cb84bcd36fc6d96130e9832a6af" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#a8d0d8e0a12987ebccc56c09c7e7dbd6a" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlitSquare.html#a94521b4224d0873f5e783c721c123b21" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a><a class="code" href="classstk_1_1BlitSquare.html#a77972e4e1c53600bf80cf692601ccae1">00085</a> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a77972e4e1c53600bf80cf692601ccae1" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00106"></a>00106 StkFloat rate_;
|
||||
<a name="l00107"></a>00107 StkFloat phase_;
|
||||
<a name="l00108"></a>00108 StkFloat p_;
|
||||
<a name="l00109"></a>00109 StkFloat a_;
|
||||
<a name="l00110"></a>00110 StkFloat lastBlitOutput_;
|
||||
<a name="l00111"></a>00111 StkFloat dcbState_;
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 StkFloat temp = lastBlitOutput_;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// A fully optimized version of this would replace the two sin calls</span>
|
||||
<a name="l00119"></a>00119 <span class="comment">// with a pair of fast sin oscillators, for which stable fast </span>
|
||||
<a name="l00120"></a>00120 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00121"></a>00121 <span class="comment">// which favors clarity over performance, the optimization has </span>
|
||||
<a name="l00122"></a>00122 <span class="comment">// not been made here.</span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="comment">// Avoid a divide by zero, or use of a denomralized divisor</span>
|
||||
<a name="l00125"></a>00125 <span class="comment">// at the sinc peak, which has a limiting value of 1.0.</span>
|
||||
<a name="l00126"></a>00126 StkFloat denominator = sin( phase_ );
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( fabs( denominator ) < std::numeric_limits<StkFloat>::epsilon() ) {
|
||||
<a name="l00128"></a>00128 <span class="comment">// Inexact comparison safely distinguishes betwen *close to zero*, and *close to PI*.</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( phase_ < 0.1f || phase_ > TWO_PI - 0.1f )
|
||||
<a name="l00130"></a>00130 lastBlitOutput_ = a_;
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span>
|
||||
<a name="l00132"></a>00132 lastBlitOutput_ = -a_;
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 lastBlitOutput_ = sin( m_ * phase_ );
|
||||
<a name="l00136"></a>00136 lastBlitOutput_ /= p_ * denominator;
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 lastBlitOutput_ += temp;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Now apply DC blocker.</span>
|
||||
<a name="l00142"></a>00142 lastFrame_[0] = lastBlitOutput_ - dcbState_ + 0.999 * lastFrame_[0];
|
||||
<a name="l00143"></a>00143 dcbState_ = lastBlitOutput_;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 phase_ += rate_;
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">if</span> ( phase_ >= TWO_PI ) phase_ -= TWO_PI;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a><a class="code" href="classstk_1_1BlitSquare.html#a7df894d40b3d6effbb2a09819356258d">00151</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00152"></a>00152 {
|
||||
<a name="l00153"></a>00153 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00155"></a>00155 oStream_ << <span class="stringliteral">"BlitSquare::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span>
|
||||
<a name="l00160"></a>00160 StkFloat *samples = &frames[channel];
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00162"></a>00162 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00163"></a>00163 *samples = <a class="code" href="classstk_1_1BlitSquare.html#a04366d55cecb4c8a726ea0519683d817" title="Compute and return one output sample.">BlitSquare::tick</a>();
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00166"></a>00166 }
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
124
doc/html/Blit_8h_source.html
Normal file
124
doc/html/Blit_8h_source.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Blit.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLIT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLIT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <limits></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Blit.html">00033</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Blit.html" title="STK band-limited impulse train class.">Blit</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00034"></a>00034 {
|
||||
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Blit.html#a63c5e6dca28aa3b3c01808e049f3da33" title="Default constructor that initializes BLIT frequency to 220 Hz.">Blit</a>( StkFloat frequency = 220.0 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Blit.html#abed25206cc6cdb5fa8d667e7db0056a9" title="Class destructor.">~Blit</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#abbe50319cd6ed762c15e148a8abb4920" title="Resets the oscillator state and phase to 0.">reset</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Blit.html#a58e2197cedfc366145b729256bf365cb">00049</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a58e2197cedfc366145b729256bf365cb" title="Set the phase of the signal.">setPhase</a>( StkFloat phase ) { phase_ = PI * phase; };
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Blit.html#a01fb40970e8905e47b7f39a1fb01589f">00055</a> StkFloat <a class="code" href="classstk_1_1Blit.html#a01fb40970e8905e47b7f39a1fb01589f" title="Get the current phase of the signal.">getPhase</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> phase_ / PI; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a5571562e489947c4beccc206ecccfbdd" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Blit.html#a5a1fd506ab12ae614afaf0e402d24d30" title="Set the number of harmonics generated in the signal.">setHarmonics</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Blit.html#a530af82a27731734af4f4b58bce283de">00076</a> StkFloat <a class="code" href="classstk_1_1Blit.html#a530af82a27731734af4f4b58bce283de" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 StkFloat <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> updateHarmonics( <span class="keywordtype">void</span> );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nHarmonics_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_;
|
||||
<a name="l00097"></a>00097 StkFloat rate_;
|
||||
<a name="l00098"></a>00098 StkFloat phase_;
|
||||
<a name="l00099"></a>00099 StkFloat p_;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 };
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717">00103</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00104"></a>00104 {
|
||||
<a name="l00105"></a>00105 <span class="comment">// The code below implements the SincM algorithm of Stilson and</span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// Smith with an additional scale factor of P / M applied to</span>
|
||||
<a name="l00107"></a>00107 <span class="comment">// normalize the output.</span>
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="comment">// A fully optimized version of this code would replace the two sin</span>
|
||||
<a name="l00110"></a>00110 <span class="comment">// calls with a pair of fast sin oscillators, for which stable fast</span>
|
||||
<a name="l00111"></a>00111 <span class="comment">// two-multiply algorithms are well known. In the spirit of STK,</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// which favors clarity over performance, the optimization has not</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// been made here.</span>
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="comment">// Avoid a divide by zero at the sinc peak, which has a limiting</span>
|
||||
<a name="l00116"></a>00116 <span class="comment">// value of 1.0.</span>
|
||||
<a name="l00117"></a>00117 StkFloat tmp, denominator = sin( phase_ );
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( denominator <= std::numeric_limits<StkFloat>::epsilon() )
|
||||
<a name="l00119"></a>00119 tmp = 1.0;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">else</span> {
|
||||
<a name="l00121"></a>00121 tmp = sin( m_ * phase_ );
|
||||
<a name="l00122"></a>00122 tmp /= m_ * denominator;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 phase_ += rate_;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( phase_ >= PI ) phase_ -= PI;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = tmp;
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a><a class="code" href="classstk_1_1Blit.html#a20a3634131ff890641931c1d04df19ad">00132</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00133"></a>00133 {
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00136"></a>00136 oStream_ << <span class="stringliteral">"Blit::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00137"></a>00137 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></span>
|
||||
<a name="l00141"></a>00141 StkFloat *samples = &frames[channel];
|
||||
<a name="l00142"></a>00142 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00143"></a>00143 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00144"></a>00144 *samples = <a class="code" href="classstk_1_1Blit.html#a528b8dc95499b11d6173cf065d62c717" title="Compute and return one output sample.">Blit::tick</a>();
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BlowBotl_8h_source.html
Normal file
134
doc/html/BlowBotl_8h_source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowBotl.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWBOTL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWBOTL_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 "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1BlowBotl.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowBotl.html" title="STK blown bottle instrument class.">BlowBotl</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1BlowBotl.html#aa505b4fc32ffe974b5840163395c321c" title="Class constructor.">BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1BlowBotl.html#adae826b0487471da1779761b0f885cb8" title="Class destructor.">~BlowBotl</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a271161f45e0a706d8ccd299f9aaf2ada" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a75b679cd641bb4bae9bc4ac3021a03e3" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a926d428669edf9c87a1f88faf01550c4" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a91a174c3501aafbbfe6841f6915fe4f3" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#afaf3f964cbdf99eddd7af99626169c02" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a132c87a453ecf25301243dc62f57f587" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowBotl.html#a21a4b2aaaac7afcc67b4abe5ed833bfd" 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="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> resonator_;
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00086"></a>00086 StkFloat maxPressure_;
|
||||
<a name="l00087"></a>00087 StkFloat noiseGain_;
|
||||
<a name="l00088"></a>00088 StkFloat vibratoGain_;
|
||||
<a name="l00089"></a>00089 StkFloat outputGain_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 };
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 StkFloat breathPressure;
|
||||
<a name="l00096"></a>00096 StkFloat randPressure;
|
||||
<a name="l00097"></a>00097 StkFloat pressureDiff;
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Calculate the breath pressure (envelope + vibrato)</span>
|
||||
<a name="l00100"></a>00100 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00101"></a>00101 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 pressureDiff = breathPressure - resonator_.<a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 randPressure = noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00106"></a>00106 randPressure *= breathPressure;
|
||||
<a name="l00107"></a>00107 randPressure *= (1.0 + pressureDiff);
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 resonator_.<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>( breathPressure + randPressure - ( jetTable_.<a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) * pressureDiff ) );
|
||||
<a name="l00110"></a>00110 lastFrame_[0] = 0.2 * outputGain_ * dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00111"></a>00111
|
||||
<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><a class="code" href="classstk_1_1BlowBotl.html#a49e1f536d821a8b2bf133533cb4bc93e">00115</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">BlowBotl :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00116"></a>00116 {
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00120"></a>00120 oStream_ << <span class="stringliteral">"BlowBotl::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#endif</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span>
|
||||
<a name="l00125"></a>00125 StkFloat *samples = &frames[channel];
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00129"></a>00129 *samples++ = <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span> {
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples++ = <a class="code" href="classstk_1_1BlowBotl.html#a68501c2422994c8dca50086b3d944119" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00135"></a>00135 *samples++ = lastFrame_[j];
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/BlowHole_8h_source.html
Normal file
156
doc/html/BlowHole_8h_source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BlowHole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BLOWHOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BLOWHOLE_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 "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00048"></a>00048 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a><a class="code" href="classstk_1_1BlowHole.html">00050</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BlowHole.html" title="STK clarinet physical model with one register hole and one tonehole.">BlowHole</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00051"></a>00051 {
|
||||
<a name="l00052"></a>00052 <span class="keyword">public</span>:
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1BlowHole.html#a7f0aed9f79544d930c7f91dfa3e0efd9" title="Class constructor.">BlowHole</a>( StkFloat lowestFrequency );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1BlowHole.html#a691a14023e9283d12b0105dd886fba86" title="Class destructor.">~BlowHole</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a43b829201197f2d0f0e8a72072e6798a" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a023aa77cd11c9dc3a8013242ff92f982" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#aaacb152624133d82e311b9e0b8218289" title="Set the tonehole state (0.0 = closed, 1.0 = fully open).">setTonehole</a>( StkFloat newValue );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a11c8a4a8483acf0f3e73c1d00008daff" title="Set the register hole state (0.0 = closed, 1.0 = fully open).">setVent</a>( StkFloat newValue );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a1be64a601f2fbc8e9efaec5a53c55866" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#aeb4dfd7d75b1996e15833c0928ed39c4" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a67e071cb26c1bba35e32f168d59b9be1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#abc3743ac2c8a9620c44cca41ce73e5b0" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BlowHole.html#a0d8ad0201c455894acb1416ffb21614b" 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="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">protected</span>:
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delays_[3];
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> tonehole_;
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> vent_;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00110"></a>00110 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00111"></a>00111 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 StkFloat scatter_;
|
||||
<a name="l00114"></a>00114 StkFloat thCoeff_;
|
||||
<a name="l00115"></a>00115 StkFloat rhGain_;
|
||||
<a name="l00116"></a>00116 StkFloat outputGain_;
|
||||
<a name="l00117"></a>00117 StkFloat noiseGain_;
|
||||
<a name="l00118"></a>00118 StkFloat vibratoGain_;
|
||||
<a name="l00119"></a>00119 };
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94">00121</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 StkFloat pressureDiff;
|
||||
<a name="l00124"></a>00124 StkFloat breathPressure;
|
||||
<a name="l00125"></a>00125 StkFloat temp;
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00128"></a>00128 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00129"></a>00129 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00130"></a>00130 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="comment">// Calculate the differential pressure = reflected - mouthpiece pressures</span>
|
||||
<a name="l00133"></a>00133 pressureDiff = delays_[0].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() - breathPressure;
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="comment">// Do two-port junction scattering for register vent</span>
|
||||
<a name="l00136"></a>00136 StkFloat pa = breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff );
|
||||
<a name="l00137"></a>00137 StkFloat pb = delays_[1].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00138"></a>00138 vent_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa+pb );
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 lastFrame_[0] = delays_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( vent_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>()+pb );
|
||||
<a name="l00141"></a>00141 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="comment">// Do three-port junction scattering (under tonehole)</span>
|
||||
<a name="l00144"></a>00144 pa += vent_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00145"></a>00145 pb = delays_[2].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00146"></a>00146 StkFloat pth = tonehole_.<a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00147"></a>00147 temp = scatter_ * (pa + pb - 2 * pth);
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 delays_[2].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>(pa + temp) * -0.95 );
|
||||
<a name="l00150"></a>00150 delays_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pb + temp );
|
||||
<a name="l00151"></a>00151 tonehole_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( pa + pb - pth + temp );
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a><a class="code" href="classstk_1_1BlowHole.html#ad220cd597fa5f6edd043c0783bdc2ec7">00156</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">BlowHole :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00157"></a>00157 {
|
||||
<a name="l00158"></a>00158 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00160"></a>00160 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00161"></a>00161 oStream_ << <span class="stringliteral">"BlowHole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00162"></a>00162 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00163"></a>00163 }
|
||||
<a name="l00164"></a>00164 <span class="preprocessor">#endif</span>
|
||||
<a name="l00165"></a>00165 <span class="preprocessor"></span>
|
||||
<a name="l00166"></a>00166 StkFloat *samples = &frames[channel];
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00168"></a>00168 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00170"></a>00170 *samples++ = <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00171"></a>00171 }
|
||||
<a name="l00172"></a>00172 <span class="keywordflow">else</span> {
|
||||
<a name="l00173"></a>00173 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00174"></a>00174 *samples++ = <a class="code" href="classstk_1_1BlowHole.html#a3438c72b975481dae7d51f33f6f6fd94" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00175"></a>00175 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00176"></a>00176 *samples++ = lastFrame_[j];
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00181"></a>00181 }
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00183"></a>00183 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00184"></a>00184
|
||||
<a name="l00185"></a>00185 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
134
doc/html/BowTable_8h_source.html
Normal file
134
doc/html/BowTable_8h_source.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>BowTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1BowTable.html">00022</a> <span class="keyword">class </span><a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1BowTable.html#a25d0985fd6821a7e1608af1e8f51952a">00026</a> <a class="code" href="classstk_1_1BowTable.html#a25d0985fd6821a7e1608af1e8f51952a" title="Default constructor.">BowTable</a>( <span class="keywordtype">void</span> ) : offset_(0.0), slope_(0.1), minOutput_(0.01), maxOutput_(0.98) {};
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1BowTable.html#a9adcc3c36085b73d3b877828071a3b2c">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a9adcc3c36085b73d3b877828071a3b2c" title="Set the table offset value.">setOffset</a>( StkFloat offset ) { offset_ = offset; };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1BowTable.html#ad8391e46941ff9f49b78bf4f77c35143">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#ad8391e46941ff9f49b78bf4f77c35143" title="Set the table slope value.">setSlope</a>( StkFloat slope ) { slope_ = slope; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1BowTable.html#a9540d5c56cfd4556ab25c25f0612b25d">00045</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a9540d5c56cfd4556ab25c25f0612b25d" title="Set the minimum table output value (0.0 - 1.0).">setMinOutput</a>( StkFloat minimum ) { minOutput_ = minimum; };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1BowTable.html#a634d5063eba886445f4057c823b00ff7">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1BowTable.html#a634d5063eba886445f4057c823b00ff7" title="Set the maximum table output value (0.0 - 1.0).">setMaxOutput</a>( StkFloat maximum ) { maxOutput_ = maximum; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 StkFloat <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <span class="keyword">protected</span>:
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 StkFloat offset_;
|
||||
<a name="l00078"></a>00078 StkFloat slope_;
|
||||
<a name="l00079"></a>00079 StkFloat minOutput_;
|
||||
<a name="l00080"></a>00080 StkFloat maxOutput_;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 };
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19">00084</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( StkFloat input )
|
||||
<a name="l00085"></a>00085 {
|
||||
<a name="l00086"></a>00086 <span class="comment">// The input represents differential string vs. bow velocity.</span>
|
||||
<a name="l00087"></a>00087 StkFloat sample = input + offset_; <span class="comment">// add bias to input</span>
|
||||
<a name="l00088"></a>00088 sample *= slope_; <span class="comment">// then scale it</span>
|
||||
<a name="l00089"></a>00089 lastFrame_[0] = (StkFloat) fabs( (<span class="keywordtype">double</span>) sample ) + (StkFloat) 0.75;
|
||||
<a name="l00090"></a>00090 lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="comment">// Set minimum threshold</span>
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">if</span> ( lastFrame_[0] < minOutput_ ) lastFrame_[0] = minOutput_;
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="comment">// Set maximum threshold</span>
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">if</span> ( lastFrame_[0] > maxOutput_ ) lastFrame_[0] = maxOutput_;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00099"></a>00099 }
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a><a class="code" href="classstk_1_1BowTable.html#a8ad2766def014b62dcbbd8765e133246">00101</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00102"></a>00102 {
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00105"></a>00105 oStream_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 StkFloat *samples = &frames[channel];
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00113"></a>00113 *samples = *samples + offset_;
|
||||
<a name="l00114"></a>00114 *samples *= slope_;
|
||||
<a name="l00115"></a>00115 *samples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *samples ) + 0.75;
|
||||
<a name="l00116"></a>00116 *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1BowTable.html#aaf72f823f210b18f417337ac7181cde5">00124</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">BowTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00128"></a>00128 oStream_ << <span class="stringliteral">"BowTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span>
|
||||
<a name="l00133"></a>00133 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00134"></a>00134 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00135"></a>00135 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00137"></a>00137 *oSamples = *iSamples + offset_;
|
||||
<a name="l00138"></a>00138 *oSamples *= slope_;
|
||||
<a name="l00139"></a>00139 *oSamples = (StkFloat) fabs( (<span class="keywordtype">double</span>) *oSamples ) + 0.75;
|
||||
<a name="l00140"></a>00140 *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00142"></a>00142 }
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
140
doc/html/Bowed_8h_source.html
Normal file
140
doc/html/Bowed_8h_source.html
Normal file
@@ -0,0 +1,140 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Bowed.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BOWED_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BOWED_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 "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BowTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <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_1Bowed.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Bowed.html" title="STK bowed string instrument class.">Bowed</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00041"></a>00041 {
|
||||
<a name="l00042"></a>00042 <span class="keyword">public</span>:
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Bowed.html#a1b442f60bbec3d07d2dd322ff761c767" title="Class constructor, taking the lowest desired playing frequency.">Bowed</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1Bowed.html#a8067e4808bf7576922be4698f853c96c" title="Class destructor.">~Bowed</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a8d522c36a35b86f90a06cf135fc83b11" title="Reset and clear all internal state.">clear</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_1Bowed.html#a02dbcfbd0766fee8a2e75a8df809e62c" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Bowed.html#a7cf229e206a61259d381cf153a1c5096">00056</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a7cf229e206a61259d381cf153a1c5096" title="Set vibrato gain.">setVibrato</a>( StkFloat gain ) { vibratoGain_ = gain; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a519d511ddcc1cf23e897aeacdfe45020" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#aae2a57d8e23536fd37a00af1fe07f21c" title="Decrease breath pressure with given rate of decrease.">stopBowing</a>( StkFloat rate );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#a4ebaf6bd27d90975e7b0aea0ee727dc1" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ab86db568328b51e4adfae8b62987fc85" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Bowed.html#ad066af9bb1340b6fcf9002d6922021f4" 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="l00072"></a>00072
|
||||
<a name="l00074"></a>00074 StkFloat <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keyword">protected</span>:
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> neckDelay_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> bridgeDelay_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1BowTable.html" title="STK bowed string table class.">BowTable</a> bowTable_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> stringFilter_;
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> bodyFilters_[6];
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">bool</span> bowDown_;
|
||||
<a name="l00097"></a>00097 StkFloat maxVelocity_;
|
||||
<a name="l00098"></a>00098 StkFloat baseDelay_;
|
||||
<a name="l00099"></a>00099 StkFloat vibratoGain_;
|
||||
<a name="l00100"></a>00100 StkFloat betaRatio_;
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 };
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 StkFloat bowVelocity = maxVelocity_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00107"></a>00107 StkFloat bridgeReflection = -stringFilter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00108"></a>00108 StkFloat nutReflection = -neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00109"></a>00109 StkFloat stringVelocity = bridgeReflection + nutReflection;
|
||||
<a name="l00110"></a>00110 StkFloat deltaV = bowVelocity - stringVelocity; <span class="comment">// Differential velocity</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 StkFloat newVelocity = 0.0;
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">if</span> ( bowDown_ )
|
||||
<a name="l00114"></a>00114 newVelocity = deltaV * bowTable_.<a class="code" href="classstk_1_1BowTable.html#a8dc58c69ecda1471dce6d142cb5f4b19" title="Take one sample input and map to one sample of output.">tick</a>( deltaV ); <span class="comment">// Non-Linear bow function</span>
|
||||
<a name="l00115"></a>00115 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( bridgeReflection + newVelocity); <span class="comment">// Do string propagations</span>
|
||||
<a name="l00116"></a>00116 bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(nutReflection + newVelocity);
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( vibratoGain_ > 0.0 ) {
|
||||
<a name="l00119"></a>00119 neckDelay_.<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( (baseDelay_ * (1.0 - betaRatio_) ) +
|
||||
<a name="l00120"></a>00120 (baseDelay_ * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>()) );
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 lastFrame_[0] = 0.1248 * bodyFilters_[5].<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>( bodyFilters_[4].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[3].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[2].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[1].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bodyFilters_[0].<a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>( bridgeDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() ) ) ) ) ) );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classstk_1_1Bowed.html#ab7985e95058016201d16f3717039e1cd">00128</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">Bowed :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00133"></a>00133 oStream_ << <span class="stringliteral">"Bowed::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00134"></a>00134 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
|
||||
<a name="l00137"></a>00137 <span class="preprocessor"></span>
|
||||
<a name="l00138"></a>00138 StkFloat *samples = &frames[channel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00142"></a>00142 *samples++ = <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">else</span> {
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00146"></a>00146 *samples++ = <a class="code" href="classstk_1_1Bowed.html#a4d583369f0b22335fff8cee3ce6f2750" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00148"></a>00148 *samples++ = lastFrame_[j];
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
132
doc/html/Brass_8h_source.html
Normal file
132
doc/html/Brass_8h_source.html
Normal file
@@ -0,0 +1,132 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Brass.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_BRASS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_BRASS_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 "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "SineWave.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="l00033"></a>00033 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Brass.html">00035</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Brass.html" title="STK simple brass instrument class.">Brass</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00036"></a>00036 {
|
||||
<a name="l00037"></a>00037 <span class="keyword">public</span>:
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Brass.html#a5bf59263a54250be84c027198c7d2d1d" title="Class constructor, taking the lowest desired playing frequency.">Brass</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Brass.html#a474528a75bd4fb88cdb9c783d73df8f6" title="Class destructor.">~Brass</a>( );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a64e48334efdc8f2508c29c5ea4281f2d" title="Reset and clear all internal state.">clear</a>( );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a5e99e7fee1b92138566a46c828df93e8" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a2e1a150328504050499c5cb9fa0e536f" title="Set the lips frequency.">setLip</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a02533e02818e2848fb6480106a54ce94" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a8bf1624aca6283fafb830a3f22546199" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#ae74eba698f27abd43e66e825f5ce72da" 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_1Brass.html#a32e2a6d2c9285bb5cf033d8a6b90e3c9" 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="keywordtype">void</span> <a class="code" href="classstk_1_1Brass.html#a4d75ac361d11fcc870a330d393dbad80" 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="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" 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="l00075"></a>00075
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> lipFilter_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat lipTarget_;
|
||||
<a name="l00093"></a>00093 StkFloat slideTarget_;
|
||||
<a name="l00094"></a>00094 StkFloat vibratoGain_;
|
||||
<a name="l00095"></a>00095 StkFloat maxPressure_;
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 };
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321">00099</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 StkFloat breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00102"></a>00102 breathPressure += vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 StkFloat mouthPressure = 0.3 * breathPressure;
|
||||
<a name="l00105"></a>00105 StkFloat borePressure = 0.85 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00106"></a>00106 StkFloat deltaPressure = mouthPressure - borePressure; <span class="comment">// Differential pressure.</span>
|
||||
<a name="l00107"></a>00107 deltaPressure = lipFilter_.<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>( deltaPressure ); <span class="comment">// Force - > position.</span>
|
||||
<a name="l00108"></a>00108 deltaPressure *= deltaPressure; <span class="comment">// Basic position to area mapping.</span>
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">if</span> ( deltaPressure > 1.0 ) deltaPressure = 1.0; <span class="comment">// Non-linear saturation.</span>
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// The following input scattering assumes the mouthPressure = area.</span>
|
||||
<a name="l00112"></a>00112 lastFrame_[0] = deltaPressure * mouthPressure + ( 1.0 - deltaPressure) * borePressure;
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ) );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a><a class="code" href="classstk_1_1Brass.html#a10334fc5573b68f2b5c2819bdba786b8">00118</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">Brass :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00119"></a>00119 {
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00121"></a>00121 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00123"></a>00123 oStream_ << <span class="stringliteral">"Brass::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00124"></a>00124 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#endif</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span>
|
||||
<a name="l00128"></a>00128 StkFloat *samples = &frames[channel];
|
||||
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00132"></a>00132 *samples++ = <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00136"></a>00136 *samples++ = <a class="code" href="classstk_1_1Brass.html#a4af1b7c4c1b374b65e04ccaa90886321" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00138"></a>00138 *samples++ = lastFrame_[j];
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
149
doc/html/Chorus_8h_source.html
Normal file
149
doc/html/Chorus_8h_source.html
Normal file
@@ -0,0 +1,149 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Chorus.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CHORUS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CHORUS_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Chorus.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Chorus.html" title="STK chorus effect class.">Chorus</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1Chorus.html#a529f668e66188ae5a42e4cc30779059f" title="Class constructor, taking the median desired delay length.">Chorus</a>( StkFloat baseDelay = 6000 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#a63acbdd04d13110712c36a5cac5d972d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#acb3a55518c919dafa6c19698c1ab3389" title="Set modulation depth in range 0.0 - 1.0.">setModDepth</a>( StkFloat depth );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Chorus.html#aa4372095b8526d62ff9cfbdb03f21c4d" title="Set modulation frequency.">setModFrequency</a>( StkFloat frequency );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00048"></a>00048 StkFloat <a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_[2];
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> mods_[2];
|
||||
<a name="l00088"></a>00088 StkFloat baseLength_;
|
||||
<a name="l00089"></a>00089 StkFloat modDepth_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 };
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#aabcc110787ec3b443c21845b2f06bb3c" title="Return the specified channel value of the last computed stereo frame.">Chorus :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00097"></a>00097 oStream_ << <span class="stringliteral">"Chorus::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00099"></a>00099 }
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span>
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a><a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf">00105</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00106"></a>00106 {
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00109"></a>00109 oStream_ << <span class="stringliteral">"Chorus::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00110"></a>00110 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor"></span>
|
||||
<a name="l00114"></a>00114 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00115"></a>00115 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00116"></a>00116 lastFrame_[0] = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00117"></a>00117 lastFrame_[1] = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1Chorus.html#aef55c6fb93a1d00498ae436868f84501">00121</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00122"></a>00122 {
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00125"></a>00125 oStream_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00126"></a>00126 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#endif</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span>
|
||||
<a name="l00130"></a>00130 StkFloat *samples = &frames[channel];
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1;
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00134"></a>00134 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00135"></a>00135 *samples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00136"></a>00136 samples++;
|
||||
<a name="l00137"></a>00137 *samples = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00141"></a>00141 lastFrame_[1] = *(samples-hop+1);
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a><a class="code" href="classstk_1_1Chorus.html#abdb8802a83f6b89716316399138e3032">00145</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">Chorus :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00146"></a>00146 {
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - 1 ) {
|
||||
<a name="l00149"></a>00149 oStream_ << <span class="stringliteral">"Chorus::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00150"></a>00150 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152 <span class="preprocessor">#endif</span>
|
||||
<a name="l00153"></a>00153 <span class="preprocessor"></span>
|
||||
<a name="l00154"></a>00154 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00155"></a>00155 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00156"></a>00156 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00157"></a>00157 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00158"></a>00158 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00159"></a>00159 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>() ) );
|
||||
<a name="l00160"></a>00160 *oSamples = effectMix_ * ( delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00161"></a>00161 *(oSamples+1) = effectMix_ * ( delayLine_[1].<a class="code" href="classstk_1_1Chorus.html#a31d5c48d5b4a030040f6bb6b5e2c99cf" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00162"></a>00162 }
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00165"></a>00165 lastFrame_[1] = *(oSamples-oHop+1);
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00167"></a>00167 }
|
||||
<a name="l00168"></a>00168
|
||||
<a name="l00169"></a>00169 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00170"></a>00170
|
||||
<a name="l00171"></a>00171 <span class="preprocessor">#endif</span>
|
||||
<a name="l00172"></a>00172 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
doc/html/Clarinet_8h_source.html
Normal file
136
doc/html/Clarinet_8h_source.html
Normal file
@@ -0,0 +1,136 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Clarinet.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CLARINET_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CLARINET_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 "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <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_1Clarinet.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Clarinet.html" title="STK clarinet physical model class.">Clarinet</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</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_1Clarinet.html#aad5cf9fb562ee87f2dc0aed0b4cd6c5b" title="Class constructor, taking the lowest desired playing frequency.">Clarinet</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Clarinet.html#a5166db9f4cf180fa189ba2e135affe34" title="Class destructor.">~Clarinet</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_1Clarinet.html#a7eae4377eb4178067c2dba704032a2d1" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#af7c1cda6af97908c9b81b1be0c2a896d" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a0e4d016135c3ee291f4d74e9b030caee" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#ae33627365f66f30c3685dc72cd7fadce" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a35f9158176c1b654c74bdf6f1296df67" 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_1Clarinet.html#a501413064397d1650e18edac92a98b2e" 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="keywordtype">void</span> <a class="code" href="classstk_1_1Clarinet.html#a63582205ab940101f5f9419fc717ff78" 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="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" 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="l00075"></a>00075
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 StkFloat outputGain_;
|
||||
<a name="l00094"></a>00094 StkFloat noiseGain_;
|
||||
<a name="l00095"></a>00095 StkFloat vibratoGain_;
|
||||
<a name="l00096"></a>00096 };
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5">00098</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 StkFloat pressureDiff;
|
||||
<a name="l00101"></a>00101 StkFloat breathPressure;
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00104"></a>00104 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00105"></a>00105 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00106"></a>00106 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Perform commuted loss filtering.</span>
|
||||
<a name="l00109"></a>00109 pressureDiff = -0.95 * filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Calculate pressure difference of reflected and mouthpiece pressures.</span>
|
||||
<a name="l00112"></a>00112 pressureDiff = pressureDiff - breathPressure;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// Perform non-linear scattering using pressure difference in reed function.</span>
|
||||
<a name="l00115"></a>00115 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>(breathPressure + pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>(pressureDiff));
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">// Apply output gain.</span>
|
||||
<a name="l00118"></a>00118 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a><a class="code" href="classstk_1_1Clarinet.html#a059174eb1ab84e306bfad1d8b5833548">00123</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">Clarinet :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00124"></a>00124 {
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00128"></a>00128 oStream_ << <span class="stringliteral">"Clarinet::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span>
|
||||
<a name="l00133"></a>00133 StkFloat *samples = &frames[channel];
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00137"></a>00137 *samples++ = <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">else</span> {
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00141"></a>00141 *samples++ = <a class="code" href="classstk_1_1Clarinet.html#a4cd08bca954ad434bc636eda957ca8d5" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00143"></a>00143 *samples++ = lastFrame_[j];
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00148"></a>00148 }
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Cubic_8h_source.html
Normal file
122
doc/html/Cubic_8h_source.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Cubic.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_CUBIC_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_CUBIC_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1Cubic.html">00029</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Cubic.html" title="STK cubic non-linearity class.">Cubic</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Cubic.html#a2059a20146f6d7ec0854dc860ca90895">00033</a> <a class="code" href="classstk_1_1Cubic.html#a2059a20146f6d7ec0854dc860ca90895" title="Default constructor.">Cubic</a>( <span class="keywordtype">void</span> ) : a1_(0.5), a2_(0.5), a3_(0.5), gain_(1.0), threshold_(1.0) {};
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1Cubic.html#af4604c69f138415f9b9ee6944d2b54ef">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#af4604c69f138415f9b9ee6944d2b54ef" title="Set the a1 coefficient value.">setA1</a>( StkFloat a1 ) { a1_ = a1; };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Cubic.html#afa16d53e6a720936543d0e0ea778f0eb">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#afa16d53e6a720936543d0e0ea778f0eb" title="Set the a2 coefficient value.">setA2</a>( StkFloat a2 ) { a2_ = a2; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Cubic.html#add4a05676471c4c09b76f5fe430b80fa">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#add4a05676471c4c09b76f5fe430b80fa" title="Set the a3 coefficient value.">setA3</a>( StkFloat a3 ) { a3_ = a3; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1Cubic.html#a3eca8ac3f81301592476aad7a2e1ec50">00045</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#a3eca8ac3f81301592476aad7a2e1ec50" title="Set the gain value.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Cubic.html#a10ba2b5c858fc2d656d49c676d5561b4">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Cubic.html#a10ba2b5c858fc2d656d49c676d5561b4" title="Set the threshold value.">setThreshold</a>( StkFloat threshold ) { threshold_ = threshold; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 StkFloat <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00062"></a>00062 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <span class="keyword">protected</span>:
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 StkFloat a1_;
|
||||
<a name="l00078"></a>00078 StkFloat a2_;
|
||||
<a name="l00079"></a>00079 StkFloat a3_;
|
||||
<a name="l00080"></a>00080 StkFloat gain_;
|
||||
<a name="l00081"></a>00081 StkFloat threshold_;
|
||||
<a name="l00082"></a>00082 };
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c">00084</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">Cubic :: tick</a>( StkFloat input )
|
||||
<a name="l00085"></a>00085 {
|
||||
<a name="l00086"></a>00086 StkFloat inSquared = input * input;
|
||||
<a name="l00087"></a>00087 StkFloat inCubed = inSquared * input;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 lastFrame_[0] = gain_ * (a1_ * input + a2_ * inSquared + a3_ * inCubed);
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">// Apply threshold if we are out of range.</span>
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">if</span> ( fabs( lastFrame_[0] ) > threshold_ ) {
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = ( lastFrame_[0] < 0 ? -threshold_ : threshold_ );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Cubic.html#af3e8a1d6ffe5e9788d841343bd5722cc">00099</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">Cubic :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"Cubic::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00111"></a>00111 *samples = <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( *samples );
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a><a class="code" href="classstk_1_1Cubic.html#aef7887fe7e5131ce48c8488a21d295b9">00117</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">Cubic :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00118"></a>00118 {
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00121"></a>00121 oStream_ << <span class="stringliteral">"Cubic::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 <span class="preprocessor">#endif</span>
|
||||
<a name="l00125"></a>00125 <span class="preprocessor"></span>
|
||||
<a name="l00126"></a>00126 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00127"></a>00127 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00128"></a>00128 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00130"></a>00130 *oSamples = <a class="code" href="classstk_1_1Cubic.html#a24e2270a347e0a6721bc0f7e0040117c" title="Input one sample to the function and return one output.">tick</a>( *iSamples );
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a>00136 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
168
doc/html/DelayA_8h_source.html
Normal file
168
doc/html/DelayA_8h_source.html
Normal file
@@ -0,0 +1,168 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayA.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYA_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYA_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1DelayA.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1DelayA.html#a9beb31f924bca961df99c1ea7789c42d" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayA</a>( StkFloat delay = 0.5, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1DelayA.html#ab6f2ee45d350b4bb3515fcdaf25a986a" title="Class destructor.">~DelayA</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#ae5e59f497eb84280fd94d60257ffae69" title="Clears all internal states of the delay line.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a><a class="code" href="classstk_1_1DelayA.html#a6ac5c818b6669bf904a4a5a81358bd28">00047</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1DelayA.html#a6ac5c818b6669bf904a4a5a81358bd28" title="Get the maximum delay-line length.">getMaximumDelay</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() - 1; };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#ab10bb5eb8316ce8b3c6667bdf4c98389" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#a83ddc9bdf2f5059159160fdac0e25eda" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1DelayA.html#a363d9ccc50acbd1f3bb533aa1ab3d9c7">00066</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#a363d9ccc50acbd1f3bb533aa1ab3d9c7" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00074"></a>00074 StkFloat <a class="code" href="classstk_1_1DelayA.html#aab723097f4634b23b0cd4ba8762271dc" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayA.html#adf33f950e60d31d355ea865ae3efd44e" title="Set the value at tapDelay samples from the delay-line input.">tapIn</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566">00080</a> StkFloat <a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00086"></a>00086 StkFloat <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 StkFloat <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00111"></a>00111 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="keyword">protected</span>:
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00117"></a>00117 StkFloat delay_;
|
||||
<a name="l00118"></a>00118 StkFloat alpha_;
|
||||
<a name="l00119"></a>00119 StkFloat coeff_;
|
||||
<a name="l00120"></a>00120 StkFloat apInput_;
|
||||
<a name="l00121"></a>00121 StkFloat nextOutput_;
|
||||
<a name="l00122"></a>00122 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00123"></a>00123 };
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a><a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314">00125</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">DelayA :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00126"></a>00126 {
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00128"></a>00128 <span class="comment">// Do allpass interpolation delay.</span>
|
||||
<a name="l00129"></a>00129 nextOutput_ = -coeff_ * lastFrame_[0];
|
||||
<a name="l00130"></a>00130 nextOutput_ += apInput_ + ( coeff_ * inputs_[outPoint_] );
|
||||
<a name="l00131"></a>00131 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74">00137</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( StkFloat input )
|
||||
<a name="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00143"></a>00143 inPoint_ = 0;
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00145"></a>00145 lastFrame_[0] = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00146"></a>00146 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Save the allpass input and increment modulo length.</span>
|
||||
<a name="l00149"></a>00149 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00151"></a>00151 outPoint_ = 0;
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a><a class="code" href="classstk_1_1DelayA.html#a57c568d56e5ed35926cfc23f83d48d98">00156</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00157"></a>00157 {
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00160"></a>00160 oStream_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00161"></a>00161 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00162"></a>00162 }
|
||||
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
|
||||
<a name="l00164"></a>00164 <span class="preprocessor"></span>
|
||||
<a name="l00165"></a>00165 StkFloat *samples = &frames[channel];
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00167"></a>00167 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00168"></a>00168 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00169"></a>00169 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00170"></a>00170 *samples = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00171"></a>00171 lastFrame_[0] = *samples;
|
||||
<a name="l00172"></a>00172 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00173"></a>00173 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00178"></a>00178 }
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00180"></a><a class="code" href="classstk_1_1DelayA.html#a94a2998c9b2d1697ed9a747973be0a89">00180</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">DelayA :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00181"></a>00181 {
|
||||
<a name="l00182"></a>00182 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00183"></a>00183 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00184"></a>00184 oStream_ << <span class="stringliteral">"DelayA::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00185"></a>00185 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00186"></a>00186 }
|
||||
<a name="l00187"></a>00187 <span class="preprocessor">#endif</span>
|
||||
<a name="l00188"></a>00188 <span class="preprocessor"></span>
|
||||
<a name="l00189"></a>00189 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00190"></a>00190 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00191"></a>00191 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00192"></a>00192 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00193"></a>00193 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00194"></a>00194 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00195"></a>00195 *oSamples = <a class="code" href="classstk_1_1DelayA.html#a08c8ade17cea4a54844f90d976b14314" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00196"></a>00196 lastFrame_[0] = *oSamples;
|
||||
<a name="l00197"></a>00197 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00198"></a>00198 apInput_ = inputs_[outPoint_++];
|
||||
<a name="l00199"></a>00199 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204
|
||||
<a name="l00205"></a>00205 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
166
doc/html/DelayL_8h_source.html
Normal file
166
doc/html/DelayL_8h_source.html
Normal file
@@ -0,0 +1,166 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>DelayL.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAYL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAYL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Delay.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="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1DelayL.html">00027</a> <span class="keyword">class </span><a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00028"></a>00028 {
|
||||
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1DelayL.html#ad60f2222397e19fe524fc3b76b59b846" title="Default constructor creates a delay-line with maximum length of 4095 samples and...">DelayL</a>( StkFloat delay = 0.0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1DelayL.html#a8f9b49c7b098d9e379baf44b0c345457" title="Class destructor.">~DelayL</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1DelayL.html#acbcb8326db134a26fdad5f16f1a0ba7e">00043</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1DelayL.html#acbcb8326db134a26fdad5f16f1a0ba7e" title="Get the maximum delay-line length.">getMaximumDelay</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() - 1; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a18b40806591654a9c9c32603990fce40" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( StkFloat delay );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1DelayL.html#aaf2d5ef7dba47ff1fb279c327021beb0">00062</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#aaf2d5ef7dba47ff1fb279c327021beb0" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00070"></a>00070 StkFloat <a class="code" href="classstk_1_1DelayL.html#ad16a1f176e93a9beb8e685aafa32579e" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1DelayL.html#a984843567ba3de6543bd13c23457f495" title="Set the value at tapDelay samples from the delay-line input.">tapIn</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9">00076</a> StkFloat <a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00082"></a>00082 StkFloat <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 StkFloat <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keyword">protected</span>:
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00113"></a>00113 StkFloat delay_;
|
||||
<a name="l00114"></a>00114 StkFloat alpha_;
|
||||
<a name="l00115"></a>00115 StkFloat omAlpha_;
|
||||
<a name="l00116"></a>00116 StkFloat nextOutput_;
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">bool</span> doNextOut_;
|
||||
<a name="l00118"></a>00118 };
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8">00120</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">DelayL :: nextOut</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">if</span> ( doNextOut_ ) {
|
||||
<a name="l00123"></a>00123 <span class="comment">// First 1/2 of interpolation</span>
|
||||
<a name="l00124"></a>00124 nextOutput_ = inputs_[outPoint_] * omAlpha_;
|
||||
<a name="l00125"></a>00125 <span class="comment">// Second 1/2 of interpolation</span>
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> (outPoint_+1 < inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>())
|
||||
<a name="l00127"></a>00127 nextOutput_ += inputs_[outPoint_+1] * alpha_;
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">else</span>
|
||||
<a name="l00129"></a>00129 nextOutput_ += inputs_[0] * alpha_;
|
||||
<a name="l00130"></a>00130 doNextOut_ = <span class="keyword">false</span>;
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">return</span> nextOutput_;
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a><a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f">00136</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( StkFloat input )
|
||||
<a name="l00137"></a>00137 {
|
||||
<a name="l00138"></a>00138 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a>00140 <span class="comment">// Increment input pointer modulo length.</span>
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00142"></a>00142 inPoint_ = 0;
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 lastFrame_[0] = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00145"></a>00145 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 <span class="comment">// Increment output pointer modulo length.</span>
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00149"></a>00149 outPoint_ = 0;
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a><a class="code" href="classstk_1_1DelayL.html#acdc5d41de53c53d9d4b39ee8a46fb96c">00154</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00155"></a>00155 {
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00158"></a>00158 oStream_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161 <span class="preprocessor">#endif</span>
|
||||
<a name="l00162"></a>00162 <span class="preprocessor"></span>
|
||||
<a name="l00163"></a>00163 StkFloat *samples = &frames[channel];
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00165"></a>00165 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00166"></a>00166 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00167"></a>00167 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00168"></a>00168 *samples = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00169"></a>00169 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00170"></a>00170 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00171"></a>00171 }
|
||||
<a name="l00172"></a>00172
|
||||
<a name="l00173"></a>00173 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a><a class="code" href="classstk_1_1DelayL.html#a56ee486fb01fbf45d5a3dbad754a838e">00177</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">DelayL :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00178"></a>00178 {
|
||||
<a name="l00179"></a>00179 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00180"></a>00180 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00181"></a>00181 oStream_ << <span class="stringliteral">"DelayL::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00182"></a>00182 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00183"></a>00183 }
|
||||
<a name="l00184"></a>00184 <span class="preprocessor">#endif</span>
|
||||
<a name="l00185"></a>00185 <span class="preprocessor"></span>
|
||||
<a name="l00186"></a>00186 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00187"></a>00187 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00188"></a>00188 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00189"></a>00189 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00190"></a>00190 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00191"></a>00191 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00192"></a>00192 *oSamples = <a class="code" href="classstk_1_1DelayL.html#abfe69d19690fab75b6026dab96870fb8" title="Return the value which will be output by the next call to tick().">nextOut</a>();
|
||||
<a name="l00193"></a>00193 doNextOut_ = <span class="keyword">true</span>;
|
||||
<a name="l00194"></a>00194 <span class="keywordflow">if</span> ( ++outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00195"></a>00195 }
|
||||
<a name="l00196"></a>00196
|
||||
<a name="l00197"></a>00197 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00198"></a>00198 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00199"></a>00199 }
|
||||
<a name="l00200"></a>00200
|
||||
<a name="l00201"></a>00201 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00202"></a>00202
|
||||
<a name="l00203"></a>00203 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
148
doc/html/Delay_8h_source.html
Normal file
148
doc/html/Delay_8h_source.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Delay.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DELAY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DELAY_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Delay.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1Delay.html#a9644532bfea44fae046e54f2509cf1ef" title="The default constructor creates a delay-line with maximum length of 4095 samples...">Delay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1Delay.html#a24b6ed6c7c5fc6d15935ec2a118b6b4f" title="Class destructor.">~Delay</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1Delay.html#a31d348fd15e5b6e23f2984b75968a3ec">00040</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#a31d348fd15e5b6e23f2984b75968a3ec" title="Get the maximum delay-line length.">getMaximumDelay</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() - 1; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#a0cf4c8da14bd4105eef06e35caaf1532" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#a5eaeed55ea0c7b30ed66fedd6ef52fc2" title="Set the delay-line length.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a><a class="code" href="classstk_1_1Delay.html#a7ae307dc997ff07ff986ca5c4d287441">00059</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Delay.html#a7ae307dc997ff07ff986ca5c4d287441" title="Return the current delay-line length.">getDelay</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delay_; };
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1Delay.html#a4d5e5bab50e4fa062bd3f0e9e2fd19db" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Delay.html#abd0b93da7a12eca94c1e68ec3b3774f1" title="Set the value at tapDelay samples from the delay-line input.">tapIn</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1Delay.html#a80f143ab956c9d3b1721958ece6da65e" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>( StkFloat value, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tapDelay );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2">00081</a> StkFloat <a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00087"></a><a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426">00087</a> StkFloat <a class="code" href="classstk_1_1Delay.html#a2433e3246551f4fdf1366884cd2ae426" title="Return the value that will be output by the next call to tick().">nextOut</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> inputs_[outPoint_]; };
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1Delay.html#a240830690cd8fa26e0604fd82c65dda1" title="Calculate and return the signal energy in the delay-line.">energy</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span>;
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093 StkFloat <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00115"></a>00115 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="keyword">protected</span>:
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> outPoint_;
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00122"></a>00122 };
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9">00124</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( StkFloat input )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00130"></a>00130 inPoint_ = 0;
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="comment">// Read out next value</span>
|
||||
<a name="l00133"></a>00133 lastFrame_[0] = inputs_[outPoint_++];
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00136"></a>00136 outPoint_ = 0;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a><a class="code" href="classstk_1_1Delay.html#a93fe8e45acb933889be812f35810f977">00141</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00142"></a>00142 {
|
||||
<a name="l00143"></a>00143 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00144"></a>00144 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00145"></a>00145 oStream_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00146"></a>00146 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148 <span class="preprocessor">#endif</span>
|
||||
<a name="l00149"></a>00149 <span class="preprocessor"></span>
|
||||
<a name="l00150"></a>00150 StkFloat *samples = &frames[channel];
|
||||
<a name="l00151"></a>00151 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00153"></a>00153 inputs_[inPoint_++] = *samples * gain_;
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00155"></a>00155 *samples = inputs_[outPoint_++];
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00160"></a>00160 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a><a class="code" href="classstk_1_1Delay.html#ade0d544e45e535fd792fe70a2a22da6f">00163</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">Delay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00164"></a>00164 {
|
||||
<a name="l00165"></a>00165 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00166"></a>00166 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00167"></a>00167 oStream_ << <span class="stringliteral">"Delay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00168"></a>00168 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00169"></a>00169 }
|
||||
<a name="l00170"></a>00170 <span class="preprocessor">#endif</span>
|
||||
<a name="l00171"></a>00171 <span class="preprocessor"></span>
|
||||
<a name="l00172"></a>00172 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00173"></a>00173 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00174"></a>00174 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00175"></a>00175 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00176"></a>00176 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00177"></a>00177 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00178"></a>00178 *oSamples = inputs_[outPoint_++];
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">if</span> ( outPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_ = 0;
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a>00186 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
121
doc/html/Drummer_8h_source.html
Normal file
121
doc/html/Drummer_8h_source.html
Normal file
@@ -0,0 +1,121 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Drummer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_DRUMMER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_DRUMMER_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 "FileWvIn.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a>00027 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_NUMWAVES = 11;
|
||||
<a name="l00028"></a>00028 <span class="keyword">const</span> <span class="keywordtype">int</span> DRUM_POLYPHONY = 4;
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Drummer.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Drummer.html" title="STK drum sample player class.">Drummer</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 name="l00037"></a>00037 <a class="code" href="classstk_1_1Drummer.html#af5262dd2b29ae453323c0a514d79d26a" title="Class constructor.">Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Drummer.html#a365fb4b2c501129f2efd6edfad1f5453" title="Class destructor.">~Drummer</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#a5ea03a0ef9a3db02942799b5cbca2ea2" title="Start a note with the given drum type and amplitude.">noteOn</a>( StkFloat instrument, StkFloat amplitude );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Drummer.html#aa735313fbdf7f1201fcb167874ecc7cc" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" 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="l00058"></a>00058
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> waves_[DRUM_POLYPHONY];
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filters_[DRUM_POLYPHONY];
|
||||
<a name="l00071"></a>00071 std::vector<int> soundOrder_;
|
||||
<a name="l00072"></a>00072 std::vector<int> soundNumber_;
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">int</span> nSounding_;
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba">00076</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 lastFrame_[0] = 0.0;
|
||||
<a name="l00079"></a>00079 <span class="keywordflow">if</span> ( nSounding_ == 0 ) <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<DRUM_POLYPHONY; i++ ) {
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">if</span> ( soundOrder_[i] >= 0 ) {
|
||||
<a name="l00083"></a>00083 <span class="keywordflow">if</span> ( waves_[i].isFinished() ) {
|
||||
<a name="l00084"></a>00084 <span class="comment">// Re-order the list.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=0; j<DRUM_POLYPHONY; j++ ) {
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">if</span> ( soundOrder_[j] > soundOrder_[i] )
|
||||
<a name="l00087"></a>00087 soundOrder_[j] -= 1;
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 soundOrder_[i] = -1;
|
||||
<a name="l00090"></a>00090 nSounding_--;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092 <span class="keywordflow">else</span>
|
||||
<a name="l00093"></a>00093 lastFrame_[0] += filters_[i].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( waves_[i].<a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Drummer.html#ad186a954527a518c47467e6caaa2e2f5">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">Drummer :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00105"></a>00105 oStream_ << <span class="stringliteral">"Drummer::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 StkFloat *samples = &frames[channel];
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">else</span> {
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00118"></a>00118 *samples++ = <a class="code" href="classstk_1_1Drummer.html#ad65c63bfad0ffac03db7f56cf706e4ba" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00120"></a>00120 *samples++ = lastFrame_[j];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
113
doc/html/Echo_8h_source.html
Normal file
113
doc/html/Echo_8h_source.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Echo.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ECHO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ECHO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Echo.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Echo.html" title="STK echo effect class.">Echo</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Echo.html#a5f3320986d5c9b02ad10663ff11b6505" title="Class constructor, taking the longest desired delay length (one second default value)...">Echo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maximumDelay = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>) <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#a253e0f8e4c628b431fdfcb6d880548c2" title="Reset and clear all internal state.">clear</a>();
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#a421a6f5f06f8e7df09edd179d397da7d" title="Set the maximum delay line length in samples.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Echo.html#ae58ea12a2864481cb7049c10810867ce" title="Set the delay line length in samples.">setDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Echo.html#a00a2a5949133a06680b026db7b21cc51">00038</a> StkFloat <a class="code" href="classstk_1_1Echo.html#a00a2a5949133a06680b026db7b21cc51" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 StkFloat <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> delayLine_;
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91">00072</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( StkFloat input )
|
||||
<a name="l00073"></a>00073 {
|
||||
<a name="l00074"></a>00074 lastFrame_[0] = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( input ) - input ) + input;
|
||||
<a name="l00075"></a>00075 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00076"></a>00076 }
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1Echo.html#aefe863b7aa43d6a94c2a56bd31a30e7d">00078</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00079"></a>00079 {
|
||||
<a name="l00080"></a>00080 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00081"></a>00081 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00082"></a>00082 oStream_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
|
||||
<a name="l00086"></a>00086 <span class="preprocessor"></span>
|
||||
<a name="l00087"></a>00087 StkFloat *samples = &frames[channel];
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00090"></a>00090 *samples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *samples ) - *samples ) + *samples;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a><a class="code" href="classstk_1_1Echo.html#a1778a7da06b222afbe9281c886f678d8">00097</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Echo.html#a4cfb2c2dd350717cd8151749d3a32f91" title="Input one sample to the effect and return one output.">Echo :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00098"></a>00098 {
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00101"></a>00101 oStream_ << <span class="stringliteral">"Echo::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#endif</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span>
|
||||
<a name="l00106"></a>00106 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00107"></a>00107 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00110"></a>00110 *oSamples = effectMix_ * ( delayLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( *iSamples ) - *iSamples ) + *iSamples;
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#endif</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
89
doc/html/Effect_8h_source.html
Normal file
89
doc/html/Effect_8h_source.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Effect.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_EFFECT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_EFFECT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Effect.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Effect.html#af6eb27819aed132dd1edf2ce9640893e">00025</a> <a class="code" href="classstk_1_1Effect.html#af6eb27819aed132dd1edf2ce9640893e" title="Class constructor.">Effect</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Effect.html#abfdef9ce644c251607acfd183e3d7f7b">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Effect.html#abfdef9ce644c251607acfd183e3d7f7b" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Effect.html#a3d7e2b8942bf7adcc71dfc6dccbb7aa0">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Effect.html#a3d7e2b8942bf7adcc71dfc6dccbb7aa0" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#a0598128d1edc97729951310cc5df5171" title="Reset and clear all internal state.">clear</a>() = 0;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">setEffectMix</a>( StkFloat mix );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a>00039 <span class="keyword">protected</span>:
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a>00041 <span class="comment">// Returns true if argument value is prime.</span>
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">bool</span> isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00045"></a>00045 StkFloat effectMix_;
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00047"></a>00047 };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d">00049</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Effect.html#ab4facbc9b317f18c139577e52fd69c3d" title="Set the mixture of input and &quot;effected&quot; levels in the output (0.0 = input...">Effect :: setEffectMix</a>( StkFloat mix )
|
||||
<a name="l00050"></a>00050 {
|
||||
<a name="l00051"></a>00051 <span class="keywordflow">if</span> ( mix < 0.0 ) {
|
||||
<a name="l00052"></a>00052 oStream_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is less than zero ... setting to zero!"</span>;
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00054"></a>00054 effectMix_ = 0.0;
|
||||
<a name="l00055"></a>00055 }
|
||||
<a name="l00056"></a>00056 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( mix > 1.0 ) {
|
||||
<a name="l00057"></a>00057 oStream_ << <span class="stringliteral">"Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!"</span>;
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00059"></a>00059 effectMix_ = 1.0;
|
||||
<a name="l00060"></a>00060 }
|
||||
<a name="l00061"></a>00061 <span class="keywordflow">else</span>
|
||||
<a name="l00062"></a>00062 effectMix_ = mix;
|
||||
<a name="l00063"></a>00063 }
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">inline</span> <span class="keywordtype">bool</span> Effect :: isPrime( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> number )
|
||||
<a name="l00066"></a>00066 {
|
||||
<a name="l00067"></a>00067 <span class="keywordflow">if</span> ( number == 2 ) <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( number & 1 ) {
|
||||
<a name="l00069"></a>00069 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=3; i<(int)sqrt((<span class="keywordtype">double</span>)number)+1; i+=2 )
|
||||
<a name="l00070"></a>00070 <span class="keywordflow">if</span> ( (number % i) == 0 ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00071"></a>00071 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// prime</span>
|
||||
<a name="l00072"></a>00072 }
|
||||
<a name="l00073"></a>00073 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// even</span>
|
||||
<a name="l00074"></a>00074 }
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="preprocessor">#endif</span>
|
||||
<a name="l00079"></a>00079 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
120
doc/html/Envelope_8h_source.html
Normal file
120
doc/html/Envelope_8h_source.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Envelope.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ENVELOPE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ENVELOPE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.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="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1Envelope.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Envelope.html#a86ea29237a8d94c109388654703a0039" title="Default constructor.">Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1Envelope.html#a64365d24b6cdd3ea3bdcaa1abcbcb60a" title="Class destructor.">~Envelope</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& <a class="code" href="classstk_1_1Envelope.html#a42a1acf6a4606163056ad7d4122d2281" title="Assignment operator.">operator= </a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a>& e );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1Envelope.html#a18cf8f21ef70227bd5cd17f53752bd0f">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a18cf8f21ef70227bd5cd17f53752bd0f" title="Set target = 1.">keyOn</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 1.0 ); };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Envelope.html#a9dbefb15f8d64aac3969f77d38791774">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a9dbefb15f8d64aac3969f77d38791774" title="Set target = 0.">keyOff</a>( <span class="keywordtype">void</span> ) { this-><a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( 0.0 ); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ade99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">setRate</a>( StkFloat rate );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#adeeb1676f9111980a0c1a48a6780c8f7" title="Set the rate based on a positive time duration (seconds).">setTime</a>( StkFloat time );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( StkFloat target );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Envelope.html#ab8164a90c57616dc8bd55a6e5ba02fb6" title="Set current and target values to value.">setValue</a>( StkFloat value );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1Envelope.html#addb2084add959a65733805bc2c1c39a9">00060</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Envelope.html#addb2084add959a65733805bc2c1c39a9" title="Return the current envelope state (0 = at target, 1 otherwise).">getState</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> state_; };
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1Envelope.html#a31044eab6eaf668ba7e74ea17bed109d">00063</a> StkFloat <a class="code" href="classstk_1_1Envelope.html#a31044eab6eaf668ba7e74ea17bed109d" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 StkFloat value_;
|
||||
<a name="l00083"></a>00083 StkFloat target_;
|
||||
<a name="l00084"></a>00084 StkFloat rate_;
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">int</span> state_;
|
||||
<a name="l00086"></a>00086 };
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a><a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601">00088</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="keywordflow">if</span> ( state_ ) {
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">if</span> ( target_ > value_ ) {
|
||||
<a name="l00092"></a>00092 value_ += rate_;
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">if</span> ( value_ >= target_ ) {
|
||||
<a name="l00094"></a>00094 value_ = target_;
|
||||
<a name="l00095"></a>00095 state_ = 0;
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098 <span class="keywordflow">else</span> {
|
||||
<a name="l00099"></a>00099 value_ -= rate_;
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">if</span> ( value_ <= target_ ) {
|
||||
<a name="l00101"></a>00101 value_ = target_;
|
||||
<a name="l00102"></a>00102 state_ = 0;
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = value_;
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">return</span> value_;
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a><a class="code" href="classstk_1_1Envelope.html#a9341c9dea4fd54c360a4a23254319cf7">00111</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">Envelope :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00112"></a>00112 {
|
||||
<a name="l00113"></a>00113 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00114"></a>00114 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00115"></a>00115 oStream_ << <span class="stringliteral">"Envelope::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00116"></a>00116 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#endif</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span>
|
||||
<a name="l00120"></a>00120 StkFloat *samples = &frames[channel];
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00123"></a>00123 *samples = <a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/FMVoices_8h_source.html
Normal file
115
doc/html/FMVoices_8h_source.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FMVoices.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FMVOICES_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FMVOICES_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_1FMVoices.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FMVoices.html" title="STK singing FM synthesis instrument.">FMVoices</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_1FMVoices.html#a27d5570c83cad660a53f04d86d01c888" title="Class constructor.">FMVoices</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FMVoices.html#a8ff218d379ec020a38e1bc7203409e37" title="Class destructor.">~FMVoices</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_1FMVoices.html#af47a92f6892f3a5bef5226d4772fc8cb" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#af2fd5dd9af61db94ff1cb556e8e5cf4c" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FMVoices.html#a24e17888ff4e01edff96d81461d670a8" 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="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 StkFloat <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <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 <span class="keywordtype">int</span> currentVowel_;
|
||||
<a name="l00077"></a>00077 StkFloat tilt_[3];
|
||||
<a name="l00078"></a>00078 StkFloat mods_[3];
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887">00081</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="keyword">register</span> StkFloat temp, temp2;
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00086"></a>00086 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.1;
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[0]);
|
||||
<a name="l00089"></a>00089 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[1]);
|
||||
<a name="l00090"></a>00090 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[2]);
|
||||
<a name="l00091"></a>00091 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[3]);
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 waves_[0]->addPhaseOffset(temp * mods_[0]);
|
||||
<a name="l00094"></a>00094 waves_[1]->addPhaseOffset(temp * mods_[1]);
|
||||
<a name="l00095"></a>00095 waves_[2]->addPhaseOffset(temp * mods_[2]);
|
||||
<a name="l00096"></a>00096 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00097"></a>00097 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00098"></a>00098 temp = gains_[0] * tilt_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00099"></a>00099 temp += gains_[1] * tilt_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00100"></a>00100 temp += gains_[2] * tilt_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 lastFrame_[0] = temp * 0.33;
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1FMVoices.html#abad16be89b38d4618a07c5d71ab49e26">00106</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">FMVoices :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00110"></a>00110 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00111"></a>00111 oStream_ << <span class="stringliteral">"FMVoices::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00112"></a>00112 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="preprocessor">#endif</span>
|
||||
<a name="l00115"></a>00115 <span class="preprocessor"></span>
|
||||
<a name="l00116"></a>00116 StkFloat *samples = &frames[channel];
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00120"></a>00120 *samples++ = <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">else</span> {
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00124"></a>00124 *samples++ = <a class="code" href="classstk_1_1FMVoices.html#a31111029e36d00230586250df7b4d887" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00126"></a>00126 *samples++ = lastFrame_[j];
|
||||
<a name="l00127"></a>00127 }
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00131"></a>00131 }
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
99
doc/html/FM_8h_source.html
Normal file
99
doc/html/FM_8h_source.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FM.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FM_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FM_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 "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "TwoZero.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FM.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00038"></a>00038 {
|
||||
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FM.html#af4732c22ce00743e1f751880fa07aa15" title="Class constructor, taking the number of wave/envelope operators to control.">FM</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> operators = 4 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FM.html#aaba7e8bff02d105e146f8b62b20a27b9" title="Class destructor.">~FM</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ac5697f9929afd43379e8720f2f271b2d" title="Reset and clear all wave and envelope states.">clear</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_1FM.html#a0a32c8327e842bb71ce945024d583941" title="Load the rawwave filenames in waves.">loadWaves</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> **filenames );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a8182c605d51ec623f90f4e07c2b90891" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a58f0898b677750a259036f628ec1a91b" title="Set the frequency ratio for the specified wave.">setRatio</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat ratio );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a65a8c54556f0c288871876ffad4d9eef" title="Set the gain for the specified wave.">setGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat gain );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6" title="Set the modulation speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( mSpeed ); };
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a><a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a">00068</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a" title="Set the modulation depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth; };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a">00071</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a" title="Set the value of control1.">setControl1</a>( StkFloat cVal ) { control1_ = cVal * 2.0; };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a><a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca">00074</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca" title="Set the value of control1.">setControl2</a>( StkFloat cVal ) { control2_ = cVal * 2.0; };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#afc46280177d770404919f20ccf88e4ff" title="Start envelopes toward &quot;on&quot; targets.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a7235e94a153df135330a591511269f7c" title="Start envelopes toward &quot;off&quot; targets.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a56cc61b1923dba2ff80859df4904d4f9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a1db9d177363fb7d8dedb20fa0c9104f1" 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="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FM.html#a81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) = 0;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00099"></a>00099 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FM.html#a81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="keyword">protected</span>:
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 std::vector<ADSR *> adsr_;
|
||||
<a name="l00104"></a>00104 std::vector<FileLoop *> waves_;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> twozero_;
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nOperators_;
|
||||
<a name="l00108"></a>00108 StkFloat baseFrequency_;
|
||||
<a name="l00109"></a>00109 std::vector<StkFloat> ratios_;
|
||||
<a name="l00110"></a>00110 std::vector<StkFloat> gains_;
|
||||
<a name="l00111"></a>00111 StkFloat modDepth_;
|
||||
<a name="l00112"></a>00112 StkFloat control1_;
|
||||
<a name="l00113"></a>00113 StkFloat control2_;
|
||||
<a name="l00114"></a>00114 StkFloat fmGains_[100];
|
||||
<a name="l00115"></a>00115 StkFloat fmSusLevels_[16];
|
||||
<a name="l00116"></a>00116 StkFloat fmAttTimes_[32];
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 };
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
97
doc/html/FileLoop_8h_source.html
Normal file
97
doc/html/FileLoop_8h_source.html
Normal file
@@ -0,0 +1,97 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileLoop.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILELOOP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILELOOP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FileWvIn.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="l00024"></a>00024 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1FileLoop.html">00026</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileLoop.html" title="STK file looping / oscillator class.">FileLoop</a> : <span class="keyword">protected</span> <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a>
|
||||
<a name="l00027"></a>00027 {
|
||||
<a name="l00028"></a>00028 <span class="keyword">public</span>:
|
||||
<a name="l00030"></a>00030 <a class="code" href="classstk_1_1FileLoop.html#a0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1FileLoop.html#a0d977aae11d75d0327057add00fa7f84" title="Default constructor.">FileLoop</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1FileLoop.html#ab6f0e0f9a5cc9c99627d0e12db007905" title="Class destructor.">~FileLoop</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00049"></a>00049 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a5905940c0dd046a95ca9c2a1d72983de" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a><a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">FileWvIn::closeFile</a>(); };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1FileLoop.html#a9f3c514ce166068197684a21d31c3a76">00058</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileLoop.html#a9f3c514ce166068197684a21d31c3a76" title="Return the number of audio channels in the data or stream.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833">00072</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7">00075</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003">00083</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead">00098</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-><a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#afe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00129"></a><a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd">00129</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) { <span class="keywordflow">return</span> <a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00141"></a>00141 StkFloat <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00153"></a>00153 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="keyword">protected</span>:
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
|
||||
<a name="l00158"></a>00158 StkFloat phaseOffset_;
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 };
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
99
doc/html/FileRead_8h_source.html
Normal file
99
doc/html/FileRead_8h_source.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileRead.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEREAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEREAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.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="l00039"></a>00039 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileRead.html">00041</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00042"></a>00042 {
|
||||
<a name="l00043"></a>00043 <span class="keyword">public</span>:
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00054"></a>00054 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00055"></a>00055 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4" title="Class destructor.">~FileRead</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157" title="Open the specified file and determine its formatting.">open</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00068"></a>00068 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a" title="If a file is open, close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a><a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488">00077</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileSize_; };
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81" title="Return the number of audio channels in the file.">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channels_; };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b">00083</a> StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> dataType_; };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00091"></a><a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199">00091</a> StkFloat <a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199" title="Return the file sample rate in Hz.">fileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileRate_; };
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8" title="Read sample frames from the file into an StkFrames object.">read</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startFrame = 0, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="keyword">protected</span>:
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="comment">// Get STK RAW file information.</span>
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">bool</span> getRawInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00112"></a>00112 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a>, StkFloat rate );
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="comment">// Get WAV file header information.</span>
|
||||
<a name="l00115"></a>00115 <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">// Get SND (AU) file header information.</span>
|
||||
<a name="l00118"></a>00118 <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="comment">// Get AIFF file header information.</span>
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="comment">// Get MAT-file header information.</span>
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Helper function for MAT-file parsing.</span>
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">bool</span> findNextMatArray( SINT32 *chunkSize, SINT32 *rows, SINT32 *columns, SINT32 *nametype );
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 FILE *fd_;
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">bool</span> wavFile_;
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;
|
||||
<a name="l00133"></a>00133 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00135"></a>00135 StkFormat dataType_;
|
||||
<a name="l00136"></a>00136 StkFloat fileRate_;
|
||||
<a name="l00137"></a>00137 };
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
105
doc/html/FileWrite_8h_source.html
Normal file
105
doc/html/FileWrite_8h_source.html
Normal file
@@ -0,0 +1,105 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWrite.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWRITE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWRITE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.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="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FileWrite.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a>00035 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FILE_TYPE;
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">00037</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">FILE_RAW</a>;
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">00038</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>;
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">00039</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>;
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">00040</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>;
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">00041</a> <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">FILE_MAT</a>;
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWrite.html#ac4da2511c8d0640ec5484f88bd704747" title="Class destructor.">~FileWrite</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a7575ddb275c902207b7b6518bb5a4ed9" title="Create a file of the specified type and name and output samples to it in the given...">open</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00060"></a>00060 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a99a19988a4dd8d608b74421cfb6cbc69" title="If a file is open, write out samples in the queue and then close it.">close</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWrite.html#a636436624aa39eb5ba3401a9279a173e" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#ad33ca8e729c14296af6dce457445832e" title="Write sample frames from the StkFrames object to the file.">write</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <span class="keyword">protected</span>:
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="comment">// Write STK RAW file header.</span>
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">bool</span> setRawFile( std::string fileName );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="comment">// Write WAV file header.</span>
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">bool</span> setWavFile( std::string fileName );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="comment">// Close WAV file, updating the header.</span>
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">void</span> closeWavFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="comment">// Write SND (AU) file header.</span>
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">bool</span> setSndFile( std::string fileName );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// Close SND file, updating the header.</span>
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> closeSndFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="comment">// Write AIFF file header.</span>
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">bool</span> setAifFile( std::string fileName );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="comment">// Close AIFF file, updating the header.</span>
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> closeAifFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="comment">// Write MAT-file header.</span>
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">bool</span> setMatFile( std::string fileName );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="comment">// Close MAT-file, updating the header.</span>
|
||||
<a name="l00103"></a>00103 <span class="keywordtype">void</span> closeMatFile( <span class="keywordtype">void</span> );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 FILE *fd_;
|
||||
<a name="l00106"></a>00106 FILE_TYPE fileType_;
|
||||
<a name="l00107"></a>00107 StkFormat dataType_;
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">bool</span> byteswap_;
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
119
doc/html/FileWvIn_8h_source.html
Normal file
119
doc/html/FileWvIn_8h_source.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileRead.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1FileWvIn.html">00042</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00043"></a>00043 {
|
||||
<a name="l00044"></a>00044 <span class="keyword">public</span>:
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1FileWvIn.html#a0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1FileWvIn.html#a0562e85c4cb0d1565d9697da966add94" title="Default constructor.">FileWvIn</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span>,
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold = 1000000, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize = 1024 );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1FileWvIn.html#ad63f10df8795ce5cb6348b0bb1ad884e" title="Class destructor.">~FileWvIn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#a7986664cd986cbacf4fb19e5c77deda1" title="Open the specified file and load its data.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span>, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ae586a93b45a979881d9bd6fc1cb364cb" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ac7dfd47e46a083d434e63c9d1b8c3d28" title="Clear outputs and reset time (file) pointer to zero.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00082"></a>00082 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aaecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aaecd1950fca3a5513e0efe4e86754b11" title="Normalize data to a maximum of +-1.0.">normalize</a>( StkFloat peak );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1FileWvIn.html#aa8ef94c3ed01af0efc9e968f09207a26">00092</a> <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileWvIn.html#aa8ef94c3ed01af0efc9e968f09207a26" title="Return the file size in sample frames.">getSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b">00100</a> <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b" title="Return the input file sample rate in Hz (not the data read rate).">getFileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> data_.<a class="code" href="classstk_1_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00103"></a><a class="code" href="classstk_1_1FileWvIn.html#aa45344366bca49f71c7153ac5b296e91">00103</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#aa45344366bca49f71c7153ac5b296e91" title="Query whether a file is open.">isOpen</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> file_.<a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>(); };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b">00106</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> finished_; };
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00112"></a>00112 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#aacd97ad5f30f9cdc8201b4244aa69901" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00118"></a>00118 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#ab2ccf7cc65c36a1ecfbb3b7d5707ea48" title="Increment the read pointer by time samples.">addTime</a>( StkFloat time );
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969">00127</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969" title="Turn linear interpolation on/off.">setInterpolate</a>( <span class="keywordtype">bool</span> doInterpolate ) { interpolate_ = doInterpolate; };
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00139"></a>00139 StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00151"></a>00151 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00162"></a>00162 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 <span class="keyword">protected</span>:
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 <a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> file_;
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">bool</span> finished_;
|
||||
<a name="l00170"></a>00170 <span class="keywordtype">bool</span> interpolate_;
|
||||
<a name="l00171"></a>00171 <span class="keywordtype">bool</span> normalizing_;
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">bool</span> chunking_;
|
||||
<a name="l00173"></a>00173 StkFloat time_;
|
||||
<a name="l00174"></a>00174 StkFloat rate_;
|
||||
<a name="l00175"></a>00175 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkThreshold_;
|
||||
<a name="l00176"></a>00176 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> chunkSize_;
|
||||
<a name="l00177"></a>00177 <span class="keywordtype">long</span> chunkPointer_;
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179 };
|
||||
<a name="l00180"></a>00180
|
||||
<a name="l00181"></a><a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608">00181</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608" title="Return the specified channel value of the last computed frame.">FileWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00182"></a>00182 {
|
||||
<a name="l00183"></a>00183 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00184"></a>00184 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00185"></a>00185 oStream_ << <span class="stringliteral">"FileWvIn::lastOut(): channel argument and soundfile data are incompatible!"</span>;
|
||||
<a name="l00186"></a>00186 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00187"></a>00187 }
|
||||
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
|
||||
<a name="l00189"></a>00189 <span class="preprocessor"></span>
|
||||
<a name="l00190"></a>00190 <span class="keywordflow">if</span> ( finished_ ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00191"></a>00191 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00192"></a>00192 }
|
||||
<a name="l00193"></a>00193
|
||||
<a name="l00194"></a>00194 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
80
doc/html/FileWvOut_8h_source.html
Normal file
80
doc/html/FileWvOut_8h_source.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FileWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FileWrite.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1FileWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWvOut.html" title="STK audio file output class.">FileWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1FileWvOut.html#a6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1FileWvOut.html#a6f0168fca20a3c9d6d5f2baedf03ec1b" title="Default constructor with optional output buffer size argument.">FileWvOut</a>( std::string fileName,
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00049"></a>00049 FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FileWrite::FILE_WAV</a>,
|
||||
<a name="l00050"></a>00050 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames = 1024 );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWvOut.html#add13d21d51f639961977b63cb481c36e" title="Class destructor.">~FileWvOut</a>();
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a31dde577d41a65018c3e03001de8d645" title="Open a new file with the specified parameters.">openFile</a>( std::string fileName,
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
||||
<a name="l00064"></a>00064 FileWrite::FILE_TYPE type,
|
||||
<a name="l00065"></a>00065 Stk::StkFormat format );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a54cbced5ce278b0d16fa800e8445103c" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWvOut.html#a9d3505aea3cd3c4d6822f05a2679dc41" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keyword">protected</span>:
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> file_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferFrames_;
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferIndex_;
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iData_;
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
116
doc/html/Filter_8h_source.html
Normal file
116
doc/html/Filter_8h_source.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Filter.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILTER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILTER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1Filter.html">00022</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a><a class="code" href="classstk_1_1Filter.html#afc70117c0133d4a5d9a651ceb691d7c0">00026</a> <a class="code" href="classstk_1_1Filter.html#afc70117c0133d4a5d9a651ceb691d7c0" title="Class constructor.">Filter</a>( <span class="keywordtype">void</span> ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1Filter.html#a48f23ab6613be35e3be8aceaf5adfdd7">00029</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#a48f23ab6613be35e3be8aceaf5adfdd7" title="Return the number of input channels for the class.">channelsIn</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channelsIn_; };
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1Filter.html#a4f1ed97c9ad8aef32e54b48da03f5275">00032</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Filter.html#a4f1ed97c9ad8aef32e54b48da03f5275" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Filter.html#a827b1bd3a99fa9af408cbd4eb559d212">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a827b1bd3a99fa9af408cbd4eb559d212" title="Set the filter gain.">setGain</a>( StkFloat gain ) { gain_ = gain; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1Filter.html#af21e11b72ea59af4585c59600a0980c2">00045</a> StkFloat <a class="code" href="classstk_1_1Filter.html#af21e11b72ea59af4585c59600a0980c2" title="Return the current filter gain.">getGain</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> gain_; };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00053"></a>00053 StkFloat <a class="code" href="classstk_1_1Filter.html#a6453c68dca60f87053c888b3635b7220" title="Return the filter phase delay at the specified frequency.">phaseDelay</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Filter.html#ab2d944f649693511dced1df249f0abe6">00056</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#ab2d944f649693511dced1df249f0abe6" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00067"></a>00067 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Filter.html#a3260a238824c4a748ac057b84b7d3f21" title="Take a channel of the StkFrames object as inputs to the filter and replace with corresponding...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 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 StkFloat gain_;
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelsIn_;
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 std::vector<StkFloat> b_;
|
||||
<a name="l00076"></a>00076 std::vector<StkFloat> a_;
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputs_;
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputs_;
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 };
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c">00082</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Filter.html#a670b9cc23ac798d3239cb819e801363c" title="Clears all internal states of the filter.">Filter :: clear</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">for</span> ( i=0; i<inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00086"></a>00086 inputs_[i] = 0.0;
|
||||
<a name="l00087"></a>00087 <span class="keywordflow">for</span> ( i=0; i<outputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00088"></a>00088 outputs_[i] = 0.0;
|
||||
<a name="l00089"></a>00089 <span class="keywordflow">for</span> ( i=0; i<lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); i++ )
|
||||
<a name="l00090"></a>00090 lastFrame_[i] = 0.0;
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a><a class="code" href="classstk_1_1Filter.html#a6453c68dca60f87053c888b3635b7220">00093</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Filter.html#a6453c68dca60f87053c888b3635b7220" title="Return the filter phase delay at the specified frequency.">Filter :: phaseDelay</a>( StkFloat frequency )
|
||||
<a name="l00094"></a>00094 {
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">if</span> ( frequency <= 0.0 || frequency > 0.5 * <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ) {
|
||||
<a name="l00096"></a>00096 oStream_ << <span class="stringliteral">"Filter::phaseDelay: argument ("</span> << frequency << <span class="stringliteral">") is out of range!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING ); <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 StkFloat omegaT = 2 * M_PI * frequency / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>();
|
||||
<a name="l00101"></a>00101 StkFloat real = 0.0, imag = 0.0;
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<b_.size(); i++ ) {
|
||||
<a name="l00103"></a>00103 real += b_[i] * std::cos( i * omegaT );
|
||||
<a name="l00104"></a>00104 imag -= b_[i] * std::sin( i * omegaT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 real *= gain_;
|
||||
<a name="l00107"></a>00107 imag *= gain_;
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 StkFloat phase = atan2( imag, real );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 real = 0.0, imag = 0.0;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<a_.size(); i++ ) {
|
||||
<a name="l00113"></a>00113 real += a_[i] * std::cos( i * omegaT );
|
||||
<a name="l00114"></a>00114 imag -= a_[i] * std::sin( i * omegaT );
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 phase -= std::atan2( imag, real );
|
||||
<a name="l00118"></a>00118 phase = std::fmod( -phase, 2 * M_PI );
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">return</span> phase / omegaT;
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
131
doc/html/Fir_8h_source.html
Normal file
131
doc/html/Fir_8h_source.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Fir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00028"></a>00028 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Fir.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Fir.html" title="STK general finite impulse response filter class.">Fir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</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_1Fir.html#a4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Fir.html#a4ad986b7f644d3e22e75b0744b2f948a" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Fir</a>( std::vector<StkFloat> &coefficients );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1Fir.html#a2a9db698672fcac97a77d95f3891b68f" title="Class destructor.">~Fir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Fir.html#aa3f72042fb8b13e9dcc31acbff4e1672" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &coefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Fir.html#a5182288d564977bf172439f6ecaf2377">00055</a> StkFloat <a class="code" href="classstk_1_1Fir.html#a5182288d564977bf172439f6ecaf2377" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058 StkFloat <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a><a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793">00086</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( StkFloat input )
|
||||
<a name="l00087"></a>00087 {
|
||||
<a name="l00088"></a>00088 lastFrame_[0] = 0.0;
|
||||
<a name="l00089"></a>00089 inputs_[0] = gain_ * input;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00092"></a>00092 lastFrame_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00093"></a>00093 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 lastFrame_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Fir.html#a602e5ce0cd93f5103796ffd50ed8c988">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00112"></a>00112 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00113"></a>00113 *samples = 0.0;
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00116"></a>00116 *samples += b_[i] * inputs_[i];
|
||||
<a name="l00117"></a>00117 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 *samples += b_[0] * inputs_[0];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a><a class="code" href="classstk_1_1Fir.html#a53bcdfc2e9ad757d2ec549529b7a9738">00126</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">Fir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00127"></a>00127 {
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00130"></a>00130 oStream_ << <span class="stringliteral">"Fir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></span>
|
||||
<a name="l00135"></a>00135 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00136"></a>00136 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00139"></a>00139 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00140"></a>00140 *oSamples = 0.0;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00143"></a>00143 *oSamples += b_[i] * inputs_[i];
|
||||
<a name="l00144"></a>00144 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146 *oSamples += b_[0] * inputs_[0];
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
147
doc/html/Flute_8h_source.html
Normal file
147
doc/html/Flute_8h_source.html
Normal file
@@ -0,0 +1,147 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Flute.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FLUTE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FLUTE_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 "JetTable.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "PoleZero.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00012"></a>00012
|
||||
<a name="l00013"></a>00013 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Flute.html">00039</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Flute.html" title="STK flute physical model class.">Flute</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00040"></a>00040 {
|
||||
<a name="l00041"></a>00041 <span class="keyword">public</span>:
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1Flute.html#a9769eef3340651acc31b4997e9985e57" title="Class constructor, taking the lowest desired playing frequency.">Flute</a>( StkFloat lowestFrequency );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1Flute.html#a76120aedfc0bab94416917d173f8a74e" title="Class destructor.">~Flute</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a4554fc4feffd469b83d02dd4e5471ffa" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#aea66780681552de9d12af6bb91f297da" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1Flute.html#a0732403c66b3667f5f6a8c80e90046e0">00058</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a0732403c66b3667f5f6a8c80e90046e0" title="Set the reflection coefficient for the jet delay (-1.0 - 1.0).">setJetReflection</a>( StkFloat coefficient ) { jetReflection_ = coefficient; };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a><a class="code" href="classstk_1_1Flute.html#a7c0ef95a3170dafde08b65ee47102969">00061</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a7c0ef95a3170dafde08b65ee47102969" title="Set the reflection coefficient for the air column delay (-1.0 - 1.0).">setEndReflection</a>( StkFloat coefficient ) { endReflection_ = coefficient; };
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ad37a862df945987f91e3164813ce911b" title="Set the length of the jet delay in terms of a ratio of jet delay to air column delay...">setJetDelay</a>( StkFloat aRatio );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a33b58e80c6ebbd5bd45f90a7a1c6a025" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a65b8e74b1a99bc8bada4e80ebd512058" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#af76a46645fd6ed5d3c15dc4bcde3d928" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#ae371e0d2366ef9fae8d12898204e7b31" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Flute.html#a968b3799338e39df35dcf94fe7ee90a2" 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="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 StkFloat <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 <span class="keyword">protected</span>:
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> jetDelay_;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> boreDelay_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> jetTable_;
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> dcBlock_;
|
||||
<a name="l00101"></a>00101 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 StkFloat lastFrequency_;
|
||||
<a name="l00106"></a>00106 StkFloat maxPressure_;
|
||||
<a name="l00107"></a>00107 StkFloat jetReflection_;
|
||||
<a name="l00108"></a>00108 StkFloat endReflection_;
|
||||
<a name="l00109"></a>00109 StkFloat noiseGain_;
|
||||
<a name="l00110"></a>00110 StkFloat vibratoGain_;
|
||||
<a name="l00111"></a>00111 StkFloat outputGain_;
|
||||
<a name="l00112"></a>00112 StkFloat jetRatio_;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 };
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a><a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe">00116</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00117"></a>00117 {
|
||||
<a name="l00118"></a>00118 StkFloat pressureDiff;
|
||||
<a name="l00119"></a>00119 StkFloat breathPressure;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00122"></a>00122 breathPressure = maxPressure_ * adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00123"></a>00123 breathPressure += breathPressure * ( noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>() + vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 StkFloat temp = -filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( boreDelay_.<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00126"></a>00126 temp = dcBlock_.<a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( temp ); <span class="comment">// Block DC on reflection.</span>
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 pressureDiff = breathPressure - (jetReflection_ * temp);
|
||||
<a name="l00129"></a>00129 pressureDiff = jetDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00130"></a>00130 pressureDiff = jetTable_.<a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( pressureDiff ) + (endReflection_ * temp);
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = (StkFloat) 0.3 * boreDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( pressureDiff );
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1Flute.html#a86640ddfacea6fd9385bc4e197fe1a28">00137</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">Flute :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00141"></a>00141 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00142"></a>00142 oStream_ << <span class="stringliteral">"Flute::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00143"></a>00143 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#endif</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span>
|
||||
<a name="l00147"></a>00147 StkFloat *samples = &frames[channel];
|
||||
<a name="l00148"></a>00148 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00151"></a>00151 *samples++ = <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">else</span> {
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00155"></a>00155 *samples++ = <a class="code" href="classstk_1_1Flute.html#ab8f307f9a26ef2756ec4c0ea05f3acbe" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00157"></a>00157 *samples++ = lastFrame_[j];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00162"></a>00162 }
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/FormSwep_8h_source.html
Normal file
156
doc/html/FormSwep_8h_source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>FormSwep.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FORMSWEP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FORMSWEP_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1FormSwep.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1FormSwep.html#aeb0093d5962acf4b5d582730e8c8bab9" title="Default constructor creates a second-order pass-through filter.">FormSwep</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1FormSwep.html#ac02cd2882f67e8ed9c315dfbf10b05a9" title="Class destructor.">~FormSwep</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a91096ebd684df25fc36a759f642b2200" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a3aede7b088dbe2ca98b3398a5f953ae7" title="Set both the current and target resonance parameters.">setStates</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a2f00d2edf80fbf8f74a284c68caf07d6" title="Set target resonance parameters.">setTargets</a>( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a27ba31acdbe8334da1830e14872fd226" title="Set the sweep rate (between 0.0 - 1.0).">setSweepRate</a>( StkFloat rate );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FormSwep.html#a242edcbe2a6f88393357b5a5ccec43e8" title="Set the sweep rate in terms of a time value in seconds.">setSweepTime</a>( StkFloat time );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70">00075</a> StkFloat <a class="code" href="classstk_1_1FormSwep.html#a3d8405c24e8539b389daf86fccfe5d70" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( StkFloat input );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">protected</span>:
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">bool</span> dirty_;
|
||||
<a name="l00107"></a>00107 StkFloat frequency_;
|
||||
<a name="l00108"></a>00108 StkFloat radius_;
|
||||
<a name="l00109"></a>00109 StkFloat startFrequency_;
|
||||
<a name="l00110"></a>00110 StkFloat startRadius_;
|
||||
<a name="l00111"></a>00111 StkFloat startGain_;
|
||||
<a name="l00112"></a>00112 StkFloat targetFrequency_;
|
||||
<a name="l00113"></a>00113 StkFloat targetRadius_;
|
||||
<a name="l00114"></a>00114 StkFloat targetGain_;
|
||||
<a name="l00115"></a>00115 StkFloat deltaFrequency_;
|
||||
<a name="l00116"></a>00116 StkFloat deltaRadius_;
|
||||
<a name="l00117"></a>00117 StkFloat deltaGain_;
|
||||
<a name="l00118"></a>00118 StkFloat sweepState_;
|
||||
<a name="l00119"></a>00119 StkFloat sweepRate_;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 };
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a><a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774">00123</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( StkFloat input )
|
||||
<a name="l00124"></a>00124 {
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">if</span> ( dirty_ ) {
|
||||
<a name="l00126"></a>00126 sweepState_ += sweepRate_;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( sweepState_ >= 1.0 ) {
|
||||
<a name="l00128"></a>00128 sweepState_ = 1.0;
|
||||
<a name="l00129"></a>00129 dirty_ = <span class="keyword">false</span>;
|
||||
<a name="l00130"></a>00130 radius_ = targetRadius_;
|
||||
<a name="l00131"></a>00131 frequency_ = targetFrequency_;
|
||||
<a name="l00132"></a>00132 gain_ = targetGain_;
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">else</span> {
|
||||
<a name="l00135"></a>00135 radius_ = startRadius_ + (deltaRadius_ * sweepState_);
|
||||
<a name="l00136"></a>00136 frequency_ = startFrequency_ + (deltaFrequency_ * sweepState_);
|
||||
<a name="l00137"></a>00137 gain_ = startGain_ + (deltaGain_ * sweepState_);
|
||||
<a name="l00138"></a>00138 }
|
||||
<a name="l00139"></a>00139 this-><a class="code" href="classstk_1_1FormSwep.html#aa6fe339cc937260c46e8c169a58d8529" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>( frequency_, radius_ );
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 inputs_[0] = gain_ * input;
|
||||
<a name="l00143"></a>00143 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
|
||||
<a name="l00144"></a>00144 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
|
||||
<a name="l00145"></a>00145 inputs_[2] = inputs_[1];
|
||||
<a name="l00146"></a>00146 inputs_[1] = inputs_[0];
|
||||
<a name="l00147"></a>00147 outputs_[2] = outputs_[1];
|
||||
<a name="l00148"></a>00148 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00151"></a>00151 }
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a><a class="code" href="classstk_1_1FormSwep.html#a27f68dc2bb3fa41322ae49cf59cc9884">00153</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00154"></a>00154 {
|
||||
<a name="l00155"></a>00155 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00156"></a>00156 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00157"></a>00157 oStream_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
|
||||
<a name="l00161"></a>00161 <span class="preprocessor"></span>
|
||||
<a name="l00162"></a>00162 StkFloat *samples = &frames[channel];
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00165"></a>00165 *samples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *samples );
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a>00167 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00168"></a>00168 }
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a><a class="code" href="classstk_1_1FormSwep.html#a8a16af2b4e169946cedb8fec2bb1417a">00170</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">FormSwep :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00171"></a>00171 {
|
||||
<a name="l00172"></a>00172 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00173"></a>00173 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00174"></a>00174 oStream_ << <span class="stringliteral">"FormSwep::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00175"></a>00175 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00176"></a>00176 }
|
||||
<a name="l00177"></a>00177 <span class="preprocessor">#endif</span>
|
||||
<a name="l00178"></a>00178 <span class="preprocessor"></span>
|
||||
<a name="l00179"></a>00179 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00180"></a>00180 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00181"></a>00181 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00183"></a>00183 *oSamples = <a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( *iSamples );
|
||||
<a name="l00184"></a>00184
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00186"></a>00186 }
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00189"></a>00189
|
||||
<a name="l00190"></a>00190 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
53
doc/html/Function_8h_source.html
Normal file
53
doc/html/Function_8h_source.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Function.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FUNCTION_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FUNCTION_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Function.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Function.html#a21648ab236a66f3f0155bdb911f9f3c3">00024</a> <a class="code" href="classstk_1_1Function.html#a21648ab236a66f3f0155bdb911f9f3c3" title="Class constructor.">Function</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1Function.html#ae79bd6d0c9f53693b4ca28948d94fc25">00027</a> StkFloat <a class="code" href="classstk_1_1Function.html#ae79bd6d0c9f53693b4ca28948d94fc25" title="Return the last computed output sample.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a>00030 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Function.html#a2545fede83a8afcbe11b3bcf3e4d9f42" title="Take one sample input and compute one sample of output.">tick</a>( StkFloat input ) = 0;
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a>00032 <span class="keyword">protected</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a>00036 };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a>00040 <span class="preprocessor">#endif</span>
|
||||
<a name="l00041"></a>00041 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
doc/html/Generator_8h_source.html
Normal file
55
doc/html/Generator_8h_source.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Generator.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GENERATOR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GENERATOR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Generator.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1Generator.html#ac7f11d287fb903b04985c2f81dbf9a5d">00025</a> <a class="code" href="classstk_1_1Generator.html#ac7f11d287fb903b04985c2f81dbf9a5d" title="Class constructor.">Generator</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Generator.html#a9f9de4c495217ef8490a9d2d1fdabe11">00028</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Generator.html#a9f9de4c495217ef8490a9d2d1fdabe11" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1Generator.html#a499ad65aa6d939983863ffb922008654">00031</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#a499ad65aa6d939983863ffb922008654" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00041"></a>00041 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Generator.html#a86bb0421223cf27e25704d5f27b97425" title="Fill the StkFrames object with computed sample frames, starting at the specified...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a>00043 <span class="keyword">protected</span>:
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00046"></a>00046 };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00048"></a>00048 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a>00050 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
158
doc/html/Granulate_8h_source.html
Normal file
158
doc/html/Granulate_8h_source.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Granulate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_GRANULATE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_GRANULATE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Envelope.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="l00026"></a>00026 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00028"></a><a class="code" href="classstk_1_1Granulate.html">00028</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Granulate.html" title="STK granular synthesis class.">Granulate</a>: <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00029"></a>00029 {
|
||||
<a name="l00030"></a>00030 <span class="keyword">public</span>:
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1Granulate.html#a78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1Granulate.html#a78af615a331de9b643dfabb8e106883f" title="Default constructor.">Granulate</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices, std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Granulate.html#a42eb1f39bd88eb8d4ca55972e7711313" title="Class destructor.">~Granulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a6227f127a77b4fc581028033cd7658d8" title="Load a monophonic soundfile to be &quot;granulated&quot;.">openFile</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00052"></a>00052 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a9b7b17ae856f3a9ece6ec462285f456c" title="Reset the file pointer and all existing grains to the file start.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a735f3ebe8fa2cacfba2c4722a56fd417" title="Set the number of simultaneous grain &quot;voices&quot; to use.">setVoices</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nVoices = 1 );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#aabd711f2b71bbcd28412d5cb73c085d6" title="Set the stretch factor used for grain playback (1 - 1000).">setStretch</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchFactor = 1 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a9b7c15080256f920646d36bfa0ed3734" title="Set global grain parameters used to determine individual grain settings.">setGrainParameters</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> duration = 30, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rampPercent = 50,
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">int</span> offset = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> delay = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Granulate.html#a02b7b85f21999d4b350beff6a925bd25" title="This factor is used when setting individual grain parameters (0.0 - 1.0).">setRandomFactor</a>( StkFloat randomness = 0.1 );
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00110"></a>00110 StkFloat <a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00113"></a>00113 StkFloat <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <span class="keyword">enum</span> GrainState {
|
||||
<a name="l00126"></a>00126 GRAIN_STOPPED,
|
||||
<a name="l00127"></a>00127 GRAIN_FADEIN,
|
||||
<a name="l00128"></a>00128 GRAIN_SUSTAIN,
|
||||
<a name="l00129"></a>00129 GRAIN_FADEOUT
|
||||
<a name="l00130"></a>00130 };
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="keyword">protected</span>:
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keyword">struct </span>Grain {
|
||||
<a name="l00135"></a>00135 StkFloat eScaler;
|
||||
<a name="l00136"></a>00136 StkFloat eRate;
|
||||
<a name="l00137"></a>00137 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> attackCount;
|
||||
<a name="l00138"></a>00138 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> sustainCount;
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> decayCount;
|
||||
<a name="l00140"></a>00140 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delayCount;
|
||||
<a name="l00141"></a>00141 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> counter;
|
||||
<a name="l00142"></a>00142 <span class="comment">//unsigned long pointer;</span>
|
||||
<a name="l00143"></a>00143 StkFloat pointer;
|
||||
<a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startPointer;
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> repeats;
|
||||
<a name="l00146"></a>00146 GrainState state;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00149"></a>00149 Grain()
|
||||
<a name="l00150"></a>00150 :eScaler(0.0), eRate(0.0), attackCount(0), sustainCount(0), decayCount(0),
|
||||
<a name="l00151"></a>00151 delayCount(0), counter(0), pointer(0), startPointer(0), repeats(0), state(GRAIN_STOPPED) {}
|
||||
<a name="l00152"></a>00152 };
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="keywordtype">void</span> calculateGrain( Granulate::Grain& grain );
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data_;
|
||||
<a name="l00157"></a>00157 std::vector<Grain> grains_;
|
||||
<a name="l00158"></a>00158 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise;
|
||||
<a name="l00159"></a>00159 <span class="comment">//long gPointer_;</span>
|
||||
<a name="l00160"></a>00160 StkFloat gPointer_;
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">// Global grain parameters.</span>
|
||||
<a name="l00163"></a>00163 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDuration_;
|
||||
<a name="l00164"></a>00164 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gRampPercent_;
|
||||
<a name="l00165"></a>00165 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDelay_;
|
||||
<a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gStretch_;
|
||||
<a name="l00167"></a>00167 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stretchCounter_;
|
||||
<a name="l00168"></a>00168 <span class="keywordtype">int</span> gOffset_;
|
||||
<a name="l00169"></a>00169 StkFloat gRandomFactor_;
|
||||
<a name="l00170"></a>00170 StkFloat gain_;
|
||||
<a name="l00171"></a>00171
|
||||
<a name="l00172"></a>00172 };
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a><a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3">00174</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Granulate.html#a60db060a365fc32fe789cb9bcd042dd3" title="Return the specified channel value of the last computed frame.">Granulate :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00175"></a>00175 {
|
||||
<a name="l00176"></a>00176 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00177"></a>00177 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00178"></a>00178 oStream_ << <span class="stringliteral">"Granulate::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00179"></a>00179 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00180"></a>00180 }
|
||||
<a name="l00181"></a>00181 <span class="preprocessor">#endif</span>
|
||||
<a name="l00182"></a>00182 <span class="preprocessor"></span>
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00184"></a>00184 }
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a><a class="code" href="classstk_1_1Granulate.html#aa9cc119b1515c5596a95d72f4b65b0c0">00186</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">Granulate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00187"></a>00187 {
|
||||
<a name="l00188"></a>00188 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00189"></a>00189 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00190"></a>00190 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00191"></a>00191 oStream_ << <span class="stringliteral">"Granulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00192"></a>00192 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00193"></a>00193 }
|
||||
<a name="l00194"></a>00194 <span class="preprocessor">#endif</span>
|
||||
<a name="l00195"></a>00195 <span class="preprocessor"></span>
|
||||
<a name="l00196"></a>00196 StkFloat *samples = &frames[channel];
|
||||
<a name="l00197"></a>00197 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00198"></a>00198 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00199"></a>00199 *samples++ = <a class="code" href="classstk_1_1Granulate.html#a0f8b162c9c309b3cbec3802138a53c24" title="Compute one sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00200"></a>00200 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00201"></a>00201 *samples++ = lastFrame_[j];
|
||||
<a name="l00202"></a>00202 }
|
||||
<a name="l00203"></a>00203
|
||||
<a name="l00204"></a>00204 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00205"></a>00205 }
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
110
doc/html/HevyMetl_8h_source.html
Normal file
110
doc/html/HevyMetl_8h_source.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.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#a61e000b4c2a8ba021e43e8074be44390" 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#a03b76a27541928bf9e7d156f9709a8f0" 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#aa7401a5cb44a69edaad304aac41b6eda" 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#a0261504b82845034be67ac573d564ff7" 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="l00057"></a>00057
|
||||
<a name="l00064"></a>00064 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 <span class="keyword">protected</span>:
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7">00070</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00071"></a>00071 {
|
||||
<a name="l00072"></a>00072 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00075"></a>00075 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00076"></a>00076 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00077"></a>00077 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00078"></a>00078 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00081"></a>00081 waves_[1]->addPhaseOffset( temp );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00084"></a>00084 temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]-><a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>() * waves_[3]->tick();
|
||||
<a name="l00085"></a>00085 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00088"></a>00088 temp = temp * control1_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00091"></a>00091 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00094"></a>00094 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a><a class="code" href="classstk_1_1HevyMetl.html#a555f3bf9322fd11150b00bb99476769a">00097</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">HevyMetl :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00098"></a>00098 {
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00102"></a>00102 oStream_ << <span class="stringliteral">"HevyMetl::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
|
||||
<a name="l00106"></a>00106 <span class="preprocessor"></span>
|
||||
<a name="l00107"></a>00107 StkFloat *samples = &frames[channel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00111"></a>00111 *samples++ = <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">else</span> {
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00115"></a>00115 *samples++ = <a class="code" href="classstk_1_1HevyMetl.html#a0261504b82845034be67ac573d564ff7" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00117"></a>00117 *samples++ = lastFrame_[j];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
156
doc/html/Iir_8h_source.html
Normal file
156
doc/html/Iir_8h_source.html
Normal file
@@ -0,0 +1,156 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Iir.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_IIR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_IIR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Iir.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Iir.html" title="STK general infinite impulse response filter class.">Iir</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Iir.html#a1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Iir.html#a1d63797b4caf775de8d351ec0c15a4c0" title="Default constructor creates a zero-order pass-through &quot;filter&quot;.">Iir</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Iir.html#ac15361cbfa19e6e4f73a155abc1459a8" title="Class destructor.">~Iir</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#aa0249b92dcec86ae83688debedb8d95b" title="Set filter coefficients.">setCoefficients</a>( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#a7a1473446857a14cdbb33cb5afde076c" title="Set numerator coefficients.">setNumerator</a>( std::vector<StkFloat> &bCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Iir.html#ae67cc04a452edfbd80f1a27097ea0187" title="Set denominator coefficients.">setDenominator</a>( std::vector<StkFloat> &aCoefficients, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1Iir.html#a5dcae9330f2c52d2bfa1647e6b250a14">00083</a> StkFloat <a class="code" href="classstk_1_1Iir.html#a5dcae9330f2c52d2bfa1647e6b250a14" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 StkFloat <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 <span class="keyword">protected</span>:
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 };
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84">00114</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( StkFloat input )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 outputs_[0] = 0.0;
|
||||
<a name="l00119"></a>00119 inputs_[0] = gain_ * input;
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00121"></a>00121 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00122"></a>00122 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00127"></a>00127 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00128"></a>00128 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 lastFrame_[0] = outputs_[0];
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a><a class="code" href="classstk_1_1Iir.html#ad03f40e022b2adfe942d30908ec34793">00135</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00136"></a>00136 {
|
||||
<a name="l00137"></a>00137 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00138"></a>00138 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00139"></a>00139 oStream_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00140"></a>00140 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#endif</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span>
|
||||
<a name="l00144"></a>00144 StkFloat *samples = &frames[channel];
|
||||
<a name="l00145"></a>00145 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00146"></a>00146 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, samples += hop ) {
|
||||
<a name="l00147"></a>00147 outputs_[0] = 0.0;
|
||||
<a name="l00148"></a>00148 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00150"></a>00150 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00151"></a>00151 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00156"></a>00156 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00157"></a>00157 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 *samples = outputs_[0];
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00165"></a>00165 }
|
||||
<a name="l00166"></a>00166
|
||||
<a name="l00167"></a><a class="code" href="classstk_1_1Iir.html#a60919d8e000bf83613bdd5e002d750f1">00167</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Iir.html#a9b79bb8ba512052a4b90444c9d2d0d84" title="Input one sample to the filter and return one output.">Iir :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00168"></a>00168 {
|
||||
<a name="l00169"></a>00169 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00170"></a>00170 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00171"></a>00171 oStream_ << <span class="stringliteral">"Iir::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00172"></a>00172 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00173"></a>00173 }
|
||||
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
|
||||
<a name="l00175"></a>00175 <span class="preprocessor"></span>
|
||||
<a name="l00176"></a>00176 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00177"></a>00177 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00178"></a>00178 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); j++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00180"></a>00180 outputs_[0] = 0.0;
|
||||
<a name="l00181"></a>00181 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( i=b_.size()-1; i>0; i-- ) {
|
||||
<a name="l00183"></a>00183 outputs_[0] += b_[i] * inputs_[i];
|
||||
<a name="l00184"></a>00184 inputs_[i] = inputs_[i-1];
|
||||
<a name="l00185"></a>00185 }
|
||||
<a name="l00186"></a>00186 outputs_[0] += b_[0] * inputs_[0];
|
||||
<a name="l00187"></a>00187
|
||||
<a name="l00188"></a>00188 <span class="keywordflow">for</span> ( i=a_.size()-1; i>0; i-- ) {
|
||||
<a name="l00189"></a>00189 outputs_[0] += -a_[i] * outputs_[i];
|
||||
<a name="l00190"></a>00190 outputs_[i] = outputs_[i-1];
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 *oSamples = outputs_[0];
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a>00196 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00197"></a>00197 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00198"></a>00198 }
|
||||
<a name="l00199"></a>00199
|
||||
<a name="l00200"></a>00200 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/InetWvIn_8h_source.html
Normal file
115
doc/html/InetWvIn_8h_source.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "TcpServer.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "UdpSocket.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Thread.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
|
||||
<a name="l00039"></a>00039 <span class="keywordtype">bool</span> finished;
|
||||
<a name="l00040"></a>00040 <span class="keywordtype">void</span> *object;
|
||||
<a name="l00041"></a>00041 } ThreadInfo;
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1InetWvIn.html">00043</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">InetWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00044"></a>00044 {
|
||||
<a name="l00045"></a>00045 <span class="keyword">public</span>:
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1InetWvIn.html#ad97edafdfb9db2aee77b11d3086113a4" title="Default constructor.">InetWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames = 1024, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers = 8 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1InetWvIn.html#a760628dfbbca0a11142d28ff5cabd8b5" title="Class destructor.">~InetWvIn</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvIn.html#af36ff382737f0fb84bc38046c01b4ce8" title="Wait for a (new) socket connection with specified protocol, port, data channels and...">listen</a>( <span class="keywordtype">int</span> port = 2006, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
||||
<a name="l00064"></a>00064 Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00065"></a>00065 Socket::ProtocolType protocol = Socket::PROTO_TCP );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1InetWvIn.html#a8b54226eabcd0c58d93fcc0792fa7e02" title="Returns true is an input connection exists or input data remains in the queue.">isConnected</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00084"></a>00084 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00097"></a>00097 StkFloat <a class="code" href="classstk_1_1InetWvIn.html#a2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1InetWvIn.html#a2109090620c80013ef3ae68cb975fb17" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="comment">// Called by the thread routine to receive data via the socket connection</span>
|
||||
<a name="l00112"></a>00112 <span class="comment">// and fill the socket buffer. This is not intended for general use but</span>
|
||||
<a name="l00113"></a>00113 <span class="comment">// must be public for access from the thread.</span>
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">void</span> receive( <span class="keywordtype">void</span> );
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="keyword">protected</span>:
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 <span class="comment">// Read buffered socket data into the data buffer ... will block if none available.</span>
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">int</span> readData( <span class="keywordtype">void</span> );
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> thread_;
|
||||
<a name="l00123"></a>00123 <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bytesFilled_;
|
||||
<a name="l00128"></a>00128 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers_;
|
||||
<a name="l00129"></a>00129 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> writePoint_;
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> readPoint_;
|
||||
<a name="l00131"></a>00131 <span class="keywordtype">long</span> bufferCounter_;
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00133"></a>00133 <span class="keywordtype">bool</span> connected_;
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">int</span> fd_;
|
||||
<a name="l00135"></a>00135 ThreadInfo threadInfo_;
|
||||
<a name="l00136"></a>00136 Stk::StkFormat dataType_;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 };
|
||||
<a name="l00139"></a>00139
|
||||
<a name="l00140"></a><a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2">00140</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1InetWvIn.html#acfd578027b2bbcbe4ceefa11e49e8cd2" title="Return the specified channel value of the last computed frame.">InetWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00141"></a>00141 {
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00144"></a>00144 oStream_ << <span class="stringliteral">"InetWvIn::lastOut(): channel argument and data stream are incompatible!"</span>;
|
||||
<a name="l00145"></a>00145 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span>
|
||||
<a name="l00149"></a>00149 <span class="comment">// If no connection and we've output all samples in the queue, return.</span>
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">if</span> ( !connected_ && bytesFilled_ == 0 && bufferCounter_ == 0 ) <span class="keywordflow">return</span> 0.0;
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
79
doc/html/InetWvOut_8h_source.html
Normal file
79
doc/html/InetWvOut_8h_source.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>InetWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INETWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INETWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Socket.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1InetWvOut.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1InetWvOut.html" title="STK internet streaming output class.">InetWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1InetWvOut.html#acc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1InetWvOut.html#acc7c0b00c68cb76d1b15e7187d67a966" title="Default constructor ... the socket is not instantiated.">InetWvOut</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00043"></a>00043 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>,
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> packetFrames = 1024 );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <a class="code" href="classstk_1_1InetWvOut.html#ae58f286de491788df700479f88b3c625" title="Class destructor.">~InetWvOut</a>();
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a4c8b6fb25c6d751b7929bec9a2d04a53" title="Connect to the specified host and port and prepare to stream nChannels of data in...">connect</a>( <span class="keywordtype">int</span> port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||
<a name="l00054"></a>00054 std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a2314d2e2d005c5b08aa24d21075af638" title="If a connection is open, write out remaining samples in the queue and then disconnect...">disconnect</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1InetWvOut.html#a800f77228d851a2d276fae6a24bcdc9a" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keyword">protected</span>:
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> incrementFrame( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <span class="comment">// Write a buffer of length frames via the socket connection.</span>
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">void</span> writeData( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frames );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">char</span> *buffer_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> *soket_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferFrames_;
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferBytes_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> bufferIndex_;
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> iData_;
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dataBytes_;
|
||||
<a name="l00093"></a>00093 Stk::StkFormat dataType_;
|
||||
<a name="l00094"></a>00094 };
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
93
doc/html/Instrmnt_8h_source.html
Normal file
93
doc/html/Instrmnt_8h_source.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Instrmnt.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_INSTRMNT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_INSTRMNT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.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="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Instrmnt.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1Instrmnt.html#a6f3c4dc01e0484f0ca4a3b14f1b7caf0">00023</a> <a class="code" href="classstk_1_1Instrmnt.html#a6f3c4dc01e0484f0ca4a3b14f1b7caf0" title="Class constructor.">Instrmnt</a>( <span class="keywordtype">void</span> ) { lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( 1, 1, 0.0 ); };
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a0736ccd253b446660938d51909a32f44" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude ) = 0;
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a582c77e71cd2c5cb46ba6f78fa0ac6a2" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude ) = 0;
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf" 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="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Instrmnt.html#a32564b611598653fce5e708821b3fcb4">00038</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Instrmnt.html#a32564b611598653fce5e708821b3fcb4" title="Return the number of output channels for the class.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1Instrmnt.html#a277ac5149ec22c33d794dfd462a82d2b">00041</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#a277ac5149ec22c33d794dfd462a82d2b" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a>00058 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00068"></a>00068 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Instrmnt.html#ad5d070c1fc6f93124dfed2a27b8e3cf1" title="Compute one sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="keyword">protected</span>:
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a><a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7">00076</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a597efc508ad367a308fa11b8cbdc96a7" title="Set instrument parameters for a particular frequency.">Instrmnt :: setFrequency</a>( StkFloat frequency )
|
||||
<a name="l00077"></a>00077 {
|
||||
<a name="l00078"></a>00078 oStream_ << <span class="stringliteral">"Instrmnt::setFrequency: virtual setFrequency function call!"</span>;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00080"></a>00080 }
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a><a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e">00082</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">Instrmnt :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00083"></a>00083 {
|
||||
<a name="l00084"></a>00084 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00085"></a>00085 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00086"></a>00086 oStream_ << <span class="stringliteral">"Instrmnt::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00088"></a>00088 }
|
||||
<a name="l00089"></a>00089 <span class="preprocessor">#endif</span>
|
||||
<a name="l00090"></a>00090 <span class="preprocessor"></span>
|
||||
<a name="l00091"></a>00091 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00092"></a>00092 }
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a><a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf">00094</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Instrmnt.html#a5aecf9f4d4dcecdbef8271c7fe62b2cf" title="Perform the control change specified by number and value (0.0 - 128.0).">Instrmnt :: controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value )
|
||||
<a name="l00095"></a>00095 {
|
||||
<a name="l00096"></a>00096 oStream_ << <span class="stringliteral">"Instrmnt::controlChange: virtual function call!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::WARNING );
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
doc/html/JCRev_8h_source.html
Normal file
136
doc/html/JCRev_8h_source.html
Normal file
@@ -0,0 +1,136 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JCRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JCREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JCREV_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1JCRev.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JCRev.html" title="John Chowning&#39;s reverberator class.">JCRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035 <a class="code" href="classstk_1_1JCRev.html#a5b9f0e2b7acc1fcb94a663353f1253dd" title="Class constructor taking a T60 decay time argument (one second default value).">JCRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#abf92e9783e4a738b6d3a3350bfae986e" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1JCRev.html#a8f4caa6de1e662c76b853ebab814a2eb" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00052"></a>00052 StkFloat <a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00062"></a>00062 StkFloat <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keyword">protected</span>:
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[3];
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[4];
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> combFilters_[4];
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outLeftDelay_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outRightDelay_;
|
||||
<a name="l00095"></a>00095 StkFloat allpassCoefficient_;
|
||||
<a name="l00096"></a>00096 StkFloat combCoefficient_[4];
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b">00100</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">JCRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <span class="stringliteral">"JCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a><a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00">00112</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JCRev.html#ad667b48a6dbd663f2d7c49e201325f00" title="Input one sample to the effect and return the specified channel value of the computed...">JCRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00113"></a>00113 {
|
||||
<a name="l00114"></a>00114 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00115"></a>00115 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00116"></a>00116 oStream_ << <span class="stringliteral">"JCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00117"></a>00117 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#endif</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span>
|
||||
<a name="l00121"></a>00121 StkFloat temp, temp0, temp1, temp2, temp3, temp4, temp5, temp6;
|
||||
<a name="l00122"></a>00122 StkFloat filtout;
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00125"></a>00125 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00126"></a>00126 temp0 += input;
|
||||
<a name="l00127"></a>00127 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00128"></a>00128 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00131"></a>00131 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00132"></a>00132 temp1 += temp0;
|
||||
<a name="l00133"></a>00133 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00134"></a>00134 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a>00136 temp = allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00137"></a>00137 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00138"></a>00138 temp2 += temp1;
|
||||
<a name="l00139"></a>00139 allpassDelays_[2].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2);
|
||||
<a name="l00140"></a>00140 temp2 = -(allpassCoefficient_ * temp2) + temp;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 temp3 = temp2 + ( combFilters_[0].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00143"></a>00143 temp4 = temp2 + ( combFilters_[1].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00144"></a>00144 temp5 = temp2 + ( combFilters_[2].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[2] * combDelays_[2].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00145"></a>00145 temp6 = temp2 + ( combFilters_[3].<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( combCoefficient_[3] * combDelays_[3].<a class="code" href="classstk_1_1JCRev.html#a599e46bcfbc2b4b9a30a30d67580412b" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>() ) );
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 combDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3);
|
||||
<a name="l00148"></a>00148 combDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp4);
|
||||
<a name="l00149"></a>00149 combDelays_[2].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp5);
|
||||
<a name="l00150"></a>00150 combDelays_[3].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp6);
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 filtout = temp3 + temp4 + temp5 + temp6;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 lastFrame_[0] = effectMix_ * (outLeftDelay_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00155"></a>00155 lastFrame_[1] = effectMix_ * (outRightDelay_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(filtout));
|
||||
<a name="l00156"></a>00156 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00157"></a>00157 lastFrame_[0] += temp;
|
||||
<a name="l00158"></a>00158 lastFrame_[1] += temp;
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00160"></a>00160 <span class="keywordflow">return</span> 0.7 * lastFrame_[channel];
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a>00165 <span class="preprocessor">#endif</span>
|
||||
<a name="l00166"></a>00166 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/JetTable_8h_source.html
Normal file
107
doc/html/JetTable_8h_source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>JetTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_JETTABL_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_JETTABL_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.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="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1JetTable.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1JetTable.html" title="STK jet table class.">JetTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 StkFloat <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00052"></a>00052 };
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6">00054</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( StkFloat input )
|
||||
<a name="l00055"></a>00055 {
|
||||
<a name="l00056"></a>00056 <span class="comment">// Perform "table lookup" using a polynomial</span>
|
||||
<a name="l00057"></a>00057 <span class="comment">// calculation (x^3 - x), which approximates</span>
|
||||
<a name="l00058"></a>00058 <span class="comment">// the jet sigmoid behavior.</span>
|
||||
<a name="l00059"></a>00059 lastFrame_[0] = input * (input * input - 1.0);
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 <span class="comment">// Saturate at +/- 1.0.</span>
|
||||
<a name="l00062"></a>00062 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0 ) lastFrame_[0] = 1.0;
|
||||
<a name="l00063"></a>00063 <span class="keywordflow">if</span> ( lastFrame_[0] < -1.0 ) lastFrame_[0] = -1.0;
|
||||
<a name="l00064"></a>00064 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00065"></a>00065 }
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a><a class="code" href="classstk_1_1JetTable.html#ae17ee82b1ed7b185713b4ae0b7c2b0cd">00067</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00068"></a>00068 {
|
||||
<a name="l00069"></a>00069 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00070"></a>00070 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00071"></a>00071 oStream_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00073"></a>00073 }
|
||||
<a name="l00074"></a>00074 <span class="preprocessor">#endif</span>
|
||||
<a name="l00075"></a>00075 <span class="preprocessor"></span>
|
||||
<a name="l00076"></a>00076 StkFloat *samples = &frames[channel];
|
||||
<a name="l00077"></a>00077 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00079"></a>00079 *samples = *samples * (*samples * *samples - 1.0);
|
||||
<a name="l00080"></a>00080 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">if</span> ( *samples < -1.0) *samples = -1.0;
|
||||
<a name="l00082"></a>00082 }
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00086"></a>00086 }
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a><a class="code" href="classstk_1_1JetTable.html#a7b261fd07b2325348ef14e3f0ebf8429">00088</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1JetTable.html#a3fb5333e6305abdeee7cd83a10ef76b6" title="Take one sample input and map to one sample of output.">JetTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 oStream_ << <span class="stringliteral">"JetTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span>
|
||||
<a name="l00097"></a>00097 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00098"></a>00098 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00101"></a>00101 *oSamples = *oSamples * (*oSamples * *oSamples - 1.0);
|
||||
<a name="l00102"></a>00102 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">if</span> ( *oSamples < -1.0) *oSamples = -1.0;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
259
doc/html/LentPitShift_8h_source.html
Normal file
259
doc/html/LentPitShift_8h_source.html
Normal file
@@ -0,0 +1,259 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>LentPitShift.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_LENLentPitShift_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_LENLentPitShift_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1LentPitShift.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1LentPitShift.html" title="Pitch shifter effect class based on the Lent algorithm.">LentPitShift</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024 <a class="code" href="classstk_1_1LentPitShift.html#a0eb0c1ba3d8fdb6eaabb1c96c58ed536" title="Class constructor.">LentPitShift</a>( StkFloat periodRatio = 1.0, <span class="keywordtype">int</span> tMax = RT_BUFFER_SIZE );
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a>00026 ~<a class="code" href="classstk_1_1LentPitShift.html" title="Pitch shifter effect class based on the Lent algorithm.">LentPitShift</a>( <span class="keywordtype">void</span> ) {
|
||||
<a name="l00027"></a>00027 <span class="keyword">delete</span> window;
|
||||
<a name="l00028"></a>00028 window = NULL;
|
||||
<a name="l00029"></a>00029 <span class="keyword">delete</span> dt;
|
||||
<a name="l00030"></a>00030 dt = NULL;
|
||||
<a name="l00031"></a>00031 <span class="keyword">delete</span> dpt;
|
||||
<a name="l00032"></a>00032 dpt = NULL;
|
||||
<a name="l00033"></a>00033 <span class="keyword">delete</span> cumDt;
|
||||
<a name="l00034"></a>00034 cumDt = NULL;
|
||||
<a name="l00035"></a>00035 }
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5661bf4cd0a4b5b2bf9e4e81603c74be" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5dfe0a19b2ac3db599c808f4d676c076" title="Set the pitch shift factor (1.0 produces no shift).">setShift</a>( StkFloat shift );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 StkFloat <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00055"></a>00055 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00066"></a>00066 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">process</a>( );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 <span class="comment">// Frame storage vectors for process function</span>
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> inputFrames;
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> outputFrames;
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">int</span> ptrFrames; <span class="comment">// writing pointer</span>
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="comment">// Input delay line</span>
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> inputLine_;
|
||||
<a name="l00084"></a>00084 <span class="keywordtype">int</span> inputPtr;
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="comment">// Output delay line</span>
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> outputLine_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">double</span> outputPtr;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// Pitch tracker variables</span>
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> tMax_; <span class="comment">// Maximal period measurable by the pitch tracker.</span>
|
||||
<a name="l00092"></a>00092 <span class="comment">// It is also the size of the window used by the pitch tracker and</span>
|
||||
<a name="l00093"></a>00093 <span class="comment">// the size of the frames that can be computed by the tick function</span>
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 StkFloat threshold_; <span class="comment">// Threshold of detection for the pitch tracker</span>
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> lastPeriod_; <span class="comment">// Result of the last pitch tracking loop</span>
|
||||
<a name="l00097"></a>00097 StkFloat* dt; <span class="comment">// Array containing the euclidian distance coefficients</span>
|
||||
<a name="l00098"></a>00098 StkFloat* cumDt; <span class="comment">// Array containing the cumulative sum of the coefficients in dt</span>
|
||||
<a name="l00099"></a>00099 StkFloat* dpt; <span class="comment">// Array containing the pitch tracking function coefficients</span>
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="comment">// Pitch shifter variables</span>
|
||||
<a name="l00102"></a>00102 StkFloat env[2]; <span class="comment">// Coefficients for the linear interpolation when modifying the output samples</span>
|
||||
<a name="l00103"></a>00103 StkFloat* window; <span class="comment">// Hamming window used for the input portion extraction</span>
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">double</span> periodRatio_; <span class="comment">// Ratio of modification of the signal period</span>
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> zeroFrame; <span class="comment">// Frame of tMax_ zero samples</span>
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <span class="comment">// Coefficient delay line that could be used for a dynamic calculation of the pitch</span>
|
||||
<a name="l00109"></a>00109 <span class="comment">//Delay* coeffLine_;</span>
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 };
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a><a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445">00113</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">LentPitShift::process</a>()
|
||||
<a name="l00114"></a>00114 {
|
||||
<a name="l00115"></a>00115 StkFloat x_t; <span class="comment">// input coefficient</span>
|
||||
<a name="l00116"></a>00116 StkFloat x_t_T; <span class="comment">// previous input coefficient at T samples</span>
|
||||
<a name="l00117"></a>00117 StkFloat coeff; <span class="comment">// new coefficient for the difference function</span>
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 <span class="keywordtype">int</span> alternativePitch = tMax_; <span class="comment">// Global minimum storage</span>
|
||||
<a name="l00120"></a>00120 lastPeriod_ = tMax_+1; <span class="comment">// Storage of the lowest local minimum under the threshold</span>
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="comment">// Loop variables</span>
|
||||
<a name="l00123"></a>00123 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay_;
|
||||
<a name="l00124"></a>00124 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n;
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 <span class="comment">// Initialization of the dt coefficients. Since the</span>
|
||||
<a name="l00127"></a>00127 <span class="comment">// frames are of tMax_ length, there is no overlapping</span>
|
||||
<a name="l00128"></a>00128 <span class="comment">// between the successive windows where pitch tracking</span>
|
||||
<a name="l00129"></a>00129 <span class="comment">// is performed.</span>
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">for</span> ( delay_=1; delay_<=tMax_; delay_++ )
|
||||
<a name="l00131"></a>00131 dt[delay_] = 0.;
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="comment">// Calculation of the dt coefficients and update of the input delay line.</span>
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">for</span> ( n=0; n<inputFrames.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>(); n++ ) {
|
||||
<a name="l00135"></a>00135 x_t = inputLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( inputFrames[ n ] );
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">for</span> ( delay_=1; delay_<= tMax_; delay_++ ) {
|
||||
<a name="l00137"></a>00137 x_t_T = inputLine_.<a class="code" href="classstk_1_1Delay.html#a4d5e5bab50e4fa062bd3f0e9e2fd19db" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>( delay_ );
|
||||
<a name="l00138"></a>00138 coeff = x_t - x_t_T;
|
||||
<a name="l00139"></a>00139 dt[delay_] += coeff * coeff;
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <span class="comment">// Calculation of the pitch tracking function and test for the minima.</span>
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">for</span> ( delay_=1; delay_<=tMax_; delay_++ ) {
|
||||
<a name="l00145"></a>00145 cumDt[delay_] = dt[delay_] + cumDt[delay_-1];
|
||||
<a name="l00146"></a>00146 dpt[delay_] = dt[delay_] * delay_ / cumDt[delay_];
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Look for a minimum</span>
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( dpt[delay_-1]-dpt[delay_-2] < 0 && dpt[delay_]-dpt[delay_-1] > 0 ) {
|
||||
<a name="l00150"></a>00150 <span class="comment">// Check if the minimum is under the threshold</span>
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">if</span> ( dpt[delay_-1] < threshold_ ){
|
||||
<a name="l00152"></a>00152 lastPeriod_ = delay_-1;
|
||||
<a name="l00153"></a>00153 <span class="comment">// If a minimum is found, we can stop the loop</span>
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">break</span>;
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dpt[alternativePitch] > dpt[delay_-1] )
|
||||
<a name="l00157"></a>00157 <span class="comment">// Otherwise we store it if it is the current global minimum</span>
|
||||
<a name="l00158"></a>00158 alternativePitch = delay_-1;
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161
|
||||
<a name="l00162"></a>00162 <span class="comment">// Test for the last period length.</span>
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ( dpt[delay_]-dpt[delay_-1] < 0 ) {
|
||||
<a name="l00164"></a>00164 <span class="keywordflow">if</span> ( dpt[delay_] < threshold_ )
|
||||
<a name="l00165"></a>00165 lastPeriod_ = delay_;
|
||||
<a name="l00166"></a>00166 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dpt[alternativePitch] > dpt[delay_] )
|
||||
<a name="l00167"></a>00167 alternativePitch = delay_;
|
||||
<a name="l00168"></a>00168 }
|
||||
<a name="l00169"></a>00169
|
||||
<a name="l00170"></a>00170 <span class="keywordflow">if</span> ( lastPeriod_ == tMax_+1 )
|
||||
<a name="l00171"></a>00171 <span class="comment">// No period has been under the threshold so we used the global minimum</span>
|
||||
<a name="l00172"></a>00172 lastPeriod_ = alternativePitch;
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00174"></a>00174 <span class="comment">// We put the new zero output coefficients in the output delay line and </span>
|
||||
<a name="l00175"></a>00175 <span class="comment">// we get the previous calculated coefficients</span>
|
||||
<a name="l00176"></a>00176 outputLine_.<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( zeroFrame, outputFrames );
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a>00178 <span class="comment">// Initialization of the Hamming window used in the algorithm</span>
|
||||
<a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> n=-(<span class="keywordtype">int</span>)lastPeriod_; n<(int)lastPeriod_; n++ )
|
||||
<a name="l00180"></a>00180 window[n+lastPeriod_] = (1 + cos(PI*n/lastPeriod_)) / 2 ;
|
||||
<a name="l00181"></a>00181
|
||||
<a name="l00182"></a>00182 <span class="keywordtype">int</span> M; <span class="comment">// Index of reading in the input delay line</span>
|
||||
<a name="l00183"></a>00183 <span class="keywordtype">int</span> N; <span class="comment">// Index of writing in the output delay line</span>
|
||||
<a name="l00184"></a>00184 <span class="keywordtype">double</span> sample; <span class="comment">// Temporary storage for the new coefficient</span>
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00186"></a>00186 <span class="comment">// We loop for all the frames of length lastPeriod_ presents between inputPtr and tMax_</span>
|
||||
<a name="l00187"></a>00187 <span class="keywordflow">for</span> ( ; inputPtr<(int)(tMax_-lastPeriod_); inputPtr+=lastPeriod_ ) {
|
||||
<a name="l00188"></a>00188 <span class="comment">// Test for the decision of compression/expansion</span>
|
||||
<a name="l00189"></a>00189 <span class="keywordflow">while</span> ( outputPtr < inputPtr ) {
|
||||
<a name="l00190"></a>00190 <span class="comment">// Coefficients for the linear interpolation</span>
|
||||
<a name="l00191"></a>00191 env[1] = fmod( outputPtr + tMax_, 1.0 );
|
||||
<a name="l00192"></a>00192 env[0] = 1.0 - env[1];
|
||||
<a name="l00193"></a>00193 M = tMax_ - inputPtr + lastPeriod_ - 1; <span class="comment">// New reading pointer</span>
|
||||
<a name="l00194"></a>00194 N = 2*tMax_ - (<span class="keywordtype">unsigned</span> long)floor(outputPtr + tMax_) + lastPeriod_ - 1; <span class="comment">// New writing pointer</span>
|
||||
<a name="l00195"></a>00195 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j=0; j<2*lastPeriod_; j++,M--,N-- ) {
|
||||
<a name="l00196"></a>00196 sample = inputLine_.<a class="code" href="classstk_1_1Delay.html#a4d5e5bab50e4fa062bd3f0e9e2fd19db" title="Return the value at tapDelay samples from the delay-line input.">tapOut</a>(M) * window[j] / 2.;
|
||||
<a name="l00197"></a>00197 <span class="comment">// Linear interpolation</span>
|
||||
<a name="l00198"></a>00198 outputLine_.<a class="code" href="classstk_1_1Delay.html#a80f143ab956c9d3b1721958ece6da65e" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>(N, env[0] * sample);
|
||||
<a name="l00199"></a>00199 outputLine_.<a class="code" href="classstk_1_1Delay.html#a80f143ab956c9d3b1721958ece6da65e" title="Sum the provided value into the delay line at tapDelay samples from the input.">addTo</a>(N-1, env[1] * sample);
|
||||
<a name="l00200"></a>00200 }
|
||||
<a name="l00201"></a>00201 outputPtr = outputPtr + lastPeriod_ * periodRatio_; <span class="comment">// new output pointer</span>
|
||||
<a name="l00202"></a>00202 }
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204 <span class="comment">// Shifting of the pointers waiting for the new frame of length tMax_.</span>
|
||||
<a name="l00205"></a>00205 outputPtr -= tMax_;
|
||||
<a name="l00206"></a>00206 inputPtr -= tMax_;
|
||||
<a name="l00207"></a>00207 }
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209
|
||||
<a name="l00210"></a><a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d">00210</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( StkFloat input )
|
||||
<a name="l00211"></a>00211 {
|
||||
<a name="l00212"></a>00212 StkFloat sample;
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 inputFrames[ptrFrames] = input;
|
||||
<a name="l00215"></a>00215
|
||||
<a name="l00216"></a>00216 sample = outputFrames[ptrFrames++];
|
||||
<a name="l00217"></a>00217
|
||||
<a name="l00218"></a>00218 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00219"></a>00219 <span class="keywordflow">if</span> ( ptrFrames == (<span class="keywordtype">int</span>) inputFrames.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ){
|
||||
<a name="l00220"></a>00220 ptrFrames = 0;
|
||||
<a name="l00221"></a>00221 <a class="code" href="classstk_1_1LentPitShift.html#a5af0a9e3902ca6fc7c5d77d861d74445" title="Apply the effect on the input samples and store it.">process</a>( );
|
||||
<a name="l00222"></a>00222 }
|
||||
<a name="l00223"></a>00223
|
||||
<a name="l00224"></a>00224 <span class="keywordflow">return</span> sample;
|
||||
<a name="l00225"></a>00225 }
|
||||
<a name="l00226"></a>00226
|
||||
<a name="l00227"></a><a class="code" href="classstk_1_1LentPitShift.html#a158cb313f45bbae6ee327cbc539abdd1">00227</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00228"></a>00228 {
|
||||
<a name="l00229"></a>00229 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00230"></a>00230 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00231"></a>00231 oStream_ << <span class="stringliteral">"LentPitShift::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00232"></a>00232 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00233"></a>00233 }
|
||||
<a name="l00234"></a>00234 <span class="preprocessor">#endif</span>
|
||||
<a name="l00235"></a>00235 <span class="preprocessor"></span>
|
||||
<a name="l00236"></a>00236 StkFloat *samples = &frames[channel];
|
||||
<a name="l00237"></a>00237 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00238"></a>00238 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00239"></a>00239 *samples = <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( *samples );
|
||||
<a name="l00240"></a>00240 }
|
||||
<a name="l00241"></a>00241
|
||||
<a name="l00242"></a>00242 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00243"></a>00243 }
|
||||
<a name="l00244"></a>00244
|
||||
<a name="l00245"></a><a class="code" href="classstk_1_1LentPitShift.html#af93de733eedca65de40597bd4a1f7b2a">00245</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">LentPitShift :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00246"></a>00246 {
|
||||
<a name="l00247"></a>00247 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00248"></a>00248 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00249"></a>00249 oStream_ << <span class="stringliteral">"LentPitShift::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00250"></a>00250 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00251"></a>00251 }
|
||||
<a name="l00252"></a>00252 <span class="preprocessor">#endif</span>
|
||||
<a name="l00253"></a>00253 <span class="preprocessor"></span>
|
||||
<a name="l00254"></a>00254 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00255"></a>00255 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00256"></a>00256 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00257"></a>00257 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00258"></a>00258 *oSamples = <a class="code" href="classstk_1_1LentPitShift.html#a2bbc39e8e78dc672a0be451ec1fd6b7d" title="Input one sample to the filter and return one output.">tick</a>( *iSamples );
|
||||
<a name="l00259"></a>00259 }
|
||||
<a name="l00260"></a>00260
|
||||
<a name="l00261"></a>00261 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00262"></a>00262 }
|
||||
<a name="l00263"></a>00263
|
||||
<a name="l00264"></a>00264 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00265"></a>00265
|
||||
<a name="l00266"></a>00266 <span class="preprocessor">#endif</span>
|
||||
<a name="l00267"></a>00267 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Mandolin_8h_source.html
Normal file
122
doc/html/Mandolin_8h_source.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mandolin.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MANDOLIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MANDOLIN_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 "Twang.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileWvIn.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <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_1Mandolin.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mandolin.html" title="STK mandolin instrument model class.">Mandolin</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Mandolin.html#a5b2aaaf5697cbe57df62b568982f6300" title="Class constructor, taking the lowest desired playing frequency.">Mandolin</a>( StkFloat lowestFrequency );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mandolin.html#a92d50a0f0c1c974683bf4685cfc6ff86" title="Class destructor.">~Mandolin</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a2caec477ed0fe9479ed6d1fbdb45d827" title="Reset and clear all internal state.">clear</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_1Mandolin.html#af46367787cd0a21a04655be82d18df08" title="Detune the two strings by the given factor. A value of 1.0 produces unison strings...">setDetune</a>( StkFloat detune );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a21a5b0669b013cfd9c7142174530f629" title="Set the body size (a value of 1.0 produces the &quot;default&quot; size).">setBodySize</a>( StkFloat size );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a8a0df47cccec5225e26d3b0e702a7c02" title="Set the pluck or &quot;excitation&quot; position along the string (0.0 - 1.0).">setPluckPosition</a>( StkFloat position );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#af5beeafcdfef7b71a5dda14e0c30c7fb" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a3a2398d39b72e1c330f81f6545ac0f5c" title="Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency...">pluck</a>( StkFloat amplitude,StkFloat position );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a8b60733652e54f1d6c93d63c915c9ca7" title="Start a note with the given frequency and amplitude (0.0 - 1.0).">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#a569de60008c218f0939ab9aedd038776" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mandolin.html#abf341aa5e7d751012178ff7b853b73a1" 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="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1Twang.html" title="STK enhanced plucked string class.">Twang</a> strings_[2];
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> soundfile_[12];
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordtype">int</span> mic_;
|
||||
<a name="l00096"></a>00096 StkFloat detuning_;
|
||||
<a name="l00097"></a>00097 StkFloat frequency_;
|
||||
<a name="l00098"></a>00098 StkFloat pluckAmplitude_;
|
||||
<a name="l00099"></a>00099 };
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a><a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62">00101</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00102"></a>00102 {
|
||||
<a name="l00103"></a>00103 StkFloat temp = 0.0;
|
||||
<a name="l00104"></a>00104 <span class="keywordflow">if</span> ( !soundfile_[mic_].isFinished() )
|
||||
<a name="l00105"></a>00105 temp = soundfile_[mic_].<a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * pluckAmplitude_;
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 lastFrame_[0] = strings_[0].<a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( temp );
|
||||
<a name="l00108"></a>00108 lastFrame_[0] += strings_[1].<a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( temp );
|
||||
<a name="l00109"></a>00109 lastFrame_[0] *= 0.2;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a><a class="code" href="classstk_1_1Mandolin.html#a37134f89e73e3e62ad5dfcfb0300a12d">00114</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">Mandolin :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00115"></a>00115 {
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00117"></a>00117 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00118"></a>00118 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00119"></a>00119 oStream_ << <span class="stringliteral">"Mandolin::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00120"></a>00120 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 <span class="preprocessor">#endif</span>
|
||||
<a name="l00123"></a>00123 <span class="preprocessor"></span>
|
||||
<a name="l00124"></a>00124 StkFloat *samples = &frames[channel];
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00126"></a>00126 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00128"></a>00128 *samples++ = <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130 <span class="keywordflow">else</span> {
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00132"></a>00132 *samples++ = <a class="code" href="classstk_1_1Mandolin.html#a99f5b51e76c97299dd8c58f27a6d0e62" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00134"></a>00134 *samples++ = lastFrame_[j];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
125
doc/html/Mesh2D_8h_source.html
Normal file
125
doc/html/Mesh2D_8h_source.html
Normal file
@@ -0,0 +1,125 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mesh2D.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MESH2D_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MESH2D_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 "OnePole.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00035"></a>00035 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> NXMAX = 12;
|
||||
<a name="l00036"></a>00036 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> NYMAX = 12;
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Mesh2D.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mesh2D.html" title="Two-dimensional rectilinear waveguide mesh class.">Mesh2D</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Mesh2D.html#aef48c3c65901f62a8dbdbe606763203e" title="Class constructor, taking the x and y dimensions in samples.">Mesh2D</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> nX, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> nY );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1Mesh2D.html#ac4abd6b5190587d69c7c2b13870fb646" title="Class destructor.">~Mesh2D</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#a49f56b4865dc041ae874fbc1b80e967b" title="Reset and clear all internal state.">clear</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_1Mesh2D.html#a6834a52f03b072e18387b799f804527b" title="Set the x dimension size in samples.">setNX</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> lenX );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#a2be2badaccfeb57e52e548f1b7515fbe" title="Set the y dimension size in samples.">setNY</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> lenY );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#a9cdfa80ecccf3f12dc184003458ba3a3" title="Set the x, y input position on a 0.0 - 1.0 scale.">setInputPosition</a>( StkFloat xFactor, StkFloat yFactor );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#ab7b3d950e40308e7060e5ff9a62a8b8d" title="Set the loss filters gains (0.0 - 1.0).">setDecay</a>( StkFloat decayFactor );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#a7915dae1032ace5960c85790a7b93e0f" title="Impulse the mesh with the given amplitude (frequency ignored).">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_1Mesh2D.html#a0580962b3cc0dbac092581d0fc15127b" title="Stop a note with the given amplitude (speed of decay) ... currently ignored.">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 StkFloat <a class="code" href="classstk_1_1Mesh2D.html#a52d9552b67edea0fc6ff3e949d6331a0" title="Calculate and return the signal energy stored in the mesh.">energy</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Mesh2D.html#a688bed8725ef2d8bf4c6465251bd8b86" title="Input a sample to the mesh and compute one output sample.">inputTick</a>( StkFloat input );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mesh2D.html#acc618a91b288305785644d852cfdaf83" 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="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 StkFloat tick0();
|
||||
<a name="l00093"></a>00093 StkFloat tick1();
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">void</span> clearMesh();
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> NX_, NY_;
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> xInput_, yInput_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filterX_[NXMAX];
|
||||
<a name="l00099"></a>00099 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filterY_[NYMAX];
|
||||
<a name="l00100"></a>00100 StkFloat v_[NXMAX-1][NYMAX-1]; <span class="comment">// junction velocities</span>
|
||||
<a name="l00101"></a>00101 StkFloat vxp_[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
<a name="l00102"></a>00102 StkFloat vxm_[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
<a name="l00103"></a>00103 StkFloat vyp_[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
<a name="l00104"></a>00104 StkFloat vym_[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="comment">// Alternate buffers</span>
|
||||
<a name="l00107"></a>00107 StkFloat vxp1_[NXMAX][NYMAX]; <span class="comment">// positive-x velocity wave</span>
|
||||
<a name="l00108"></a>00108 StkFloat vxm1_[NXMAX][NYMAX]; <span class="comment">// negative-x velocity wave</span>
|
||||
<a name="l00109"></a>00109 StkFloat vyp1_[NXMAX][NYMAX]; <span class="comment">// positive-y velocity wave</span>
|
||||
<a name="l00110"></a>00110 StkFloat vym1_[NXMAX][NYMAX]; <span class="comment">// negative-y velocity wave</span>
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">int</span> counter_; <span class="comment">// time in samples</span>
|
||||
<a name="l00113"></a>00113 };
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a><a class="code" href="classstk_1_1Mesh2D.html#a0bfe62f0ab05859963571f4a9a569bd8">00115</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">Mesh2D :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00116"></a>00116 {
|
||||
<a name="l00117"></a>00117 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00120"></a>00120 oStream_ << <span class="stringliteral">"Mesh2D::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00121"></a>00121 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123 <span class="preprocessor">#endif</span>
|
||||
<a name="l00124"></a>00124 <span class="preprocessor"></span>
|
||||
<a name="l00125"></a>00125 StkFloat *samples = &frames[channel];
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00129"></a>00129 *samples++ = <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">else</span> {
|
||||
<a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00133"></a>00133 *samples++ = <a class="code" href="classstk_1_1Mesh2D.html#ae8a7e86e4774d8738098c79ab0d5e00a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00135"></a>00135 *samples++ = lastFrame_[j];
|
||||
<a name="l00136"></a>00136 }
|
||||
<a name="l00137"></a>00137 }
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
110
doc/html/Messager_8h_source.html
Normal file
110
doc/html/Messager_8h_source.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Messager.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MESSAGER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MESSAGER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Skini.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <queue></span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor">#include "Thread.h"</span>
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#include "TcpServer.h"</span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor">#include "RtMidi.h"</span>
|
||||
<a name="l00014"></a>00014
|
||||
<a name="l00015"></a>00015 <span class="preprocessor">#endif // __STK_REALTIME__</span>
|
||||
<a name="l00016"></a>00016 <span class="preprocessor"></span>
|
||||
<a name="l00017"></a>00017 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00051"></a>00051 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00053"></a>00053 <span class="keyword">const</span> <span class="keywordtype">int</span> DEFAULT_QUEUE_LIMIT = 200;
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00055"></a><a class="code" href="classstk_1_1Messager.html">00055</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Messager.html" title="STK input control message parser.">Messager</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00056"></a>00056 {
|
||||
<a name="l00057"></a>00057 <span class="keyword">public</span>:
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <span class="comment">// This structure is used to share data among the various realtime</span>
|
||||
<a name="l00060"></a>00060 <span class="comment">// messager threads. It must be public.</span>
|
||||
<a name="l00061"></a>00061 <span class="keyword">struct </span>MessagerData {
|
||||
<a name="l00062"></a>00062 <a class="code" href="classstk_1_1Skini.html" title="STK SKINI parsing class.">Skini</a> skini;
|
||||
<a name="l00063"></a>00063 std::queue<Skini::Message> queue;
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> queueLimit;
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">int</span> sources;
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00068"></a>00068 <span class="preprocessor"></span> <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> *midi;
|
||||
<a name="l00070"></a>00070 <a class="code" href="classstk_1_1TcpServer.html" title="STK TCP socket server class.">TcpServer</a> *socket;
|
||||
<a name="l00071"></a>00071 std::vector<int> fd;
|
||||
<a name="l00072"></a>00072 fd_set mask;
|
||||
<a name="l00073"></a>00073 <span class="preprocessor">#endif</span>
|
||||
<a name="l00074"></a>00074 <span class="preprocessor"></span>
|
||||
<a name="l00075"></a>00075 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00076"></a>00076 MessagerData()
|
||||
<a name="l00077"></a>00077 :queueLimit(0), sources(0) {}
|
||||
<a name="l00078"></a>00078 };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1Messager.html#aa4c8f3396345157ccd19395258a253a9" title="Default constructor.">Messager</a>();
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Messager.html#a8300dba83620cc86388780b5fa4080e0" title="Class destructor.">~Messager</a>();
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Messager.html#a18525952880382c25322e57353a34372" title="Pop the next message from the queue and write it to the referenced message structure...">popMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Messager.html#ae8b09328c103bffd180456bf57ee64b3" title="Push the referenced message onto the message stack.">pushMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#a172cf26bfebc8b4b12943e2bd76d5f72" title="Specify a SKINI formatted scorefile from which messages should be read.">setScoreFile</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* filename );
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00111"></a>00111 <span class="preprocessor"></span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"> bool startStdInput();</span>
|
||||
<a name="l00121"></a>00121 <span class="preprocessor"></span>
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#a180fd45d109a2058ecbd6a629b979cb7" title="Start a socket server, accept connections, and read &quot;realtime&quot; control...">startSocketInput</a>( <span class="keywordtype">int</span> port=2001 );
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00149"></a>00149 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Messager.html#a49877209a4ee08e684de82a73f2d9df9" title="Start MIDI input, with optional device and port identifiers.">startMidiInput</a>( <span class="keywordtype">int</span> port=0 );
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="preprocessor">#endif</span>
|
||||
<a name="l00152"></a>00152 <span class="preprocessor"></span>
|
||||
<a name="l00153"></a>00153 <span class="keyword">protected</span>:
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 MessagerData data_;
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#if defined(__STK_REALTIME__)</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></span> <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> stdinThread_;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> socketThread_;
|
||||
<a name="l00160"></a>00160 <span class="preprocessor">#endif</span>
|
||||
<a name="l00161"></a>00161 <span class="preprocessor"></span>
|
||||
<a name="l00162"></a>00162 };
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
100
doc/html/MidiFileIn_8h_source.html
Normal file
100
doc/html/MidiFileIn_8h_source.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>MidiFileIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MIDIFILEIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MIDIFILEIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include <fstream></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include <sstream></span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00027"></a>00027 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1MidiFileIn.html">00029</a> <span class="keyword">class </span><a class="code" href="classstk_1_1MidiFileIn.html" title="A standard MIDI file reading/parsing class.">MidiFileIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1MidiFileIn.html#ad273dc7c13d4c4a4ced893af93d9176e" title="Default constructor.">MidiFileIn</a>( std::string fileName );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1MidiFileIn.html#a857246dbaf234cc9d68709afea6d0141" title="Class destructor.">~MidiFileIn</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="classstk_1_1MidiFileIn.html#ac93b16c4de0ed3d98d31a2edb92bc105">00043</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#ac93b16c4de0ed3d98d31a2edb92bc105" title="Return the MIDI file format (0, 1, or 2).">getFileFormat</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> format_; };
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a><a class="code" href="classstk_1_1MidiFileIn.html#a7db7e6b2f6c1aedfbb78045106d36b17">00046</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#a7db7e6b2f6c1aedfbb78045106d36b17" title="Return the number of tracks in the MIDI file.">getNumberOfTracks</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nTracks_; };
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1MidiFileIn.html#a43bc34a26e72f3311b855139a1408f78">00054</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1MidiFileIn.html#a43bc34a26e72f3311b855139a1408f78" title="Return the MIDI file division value from the file header.">getDivision</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> division_; };
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1MidiFileIn.html#a3bd547e3ee5bb8ad780274d7a09f12ff" title="Move the specified track event reader to the beginning of its track.">rewindTrack</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00071"></a>00071 <span class="keywordtype">double</span> <a class="code" href="classstk_1_1MidiFileIn.html#a92508a5847e45a05a3ff05de3e5d3efe" title="Get the current value, in seconds, of delta-time ticks for the specified track.">getTickSeconds</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1MidiFileIn.html#a117dd19afbc42d6c769d959588f9176b" title="Fill the user-provided vector with the next event in the specified track and return...">getNextEvent</a>( std::vector<unsigned char> *event, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1MidiFileIn.html#ab10ea0e225484fa2d31796f505d4e582" title="Fill the user-provided vector with the next MIDI channel event in the specified track...">getNextMidiEvent</a>( std::vector<unsigned char> *midiEvent, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="keyword">protected</span>:
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="comment">// This protected class function is used for reading variable-length</span>
|
||||
<a name="l00104"></a>00104 <span class="comment">// MIDI file values. It is assumed that this function is called with</span>
|
||||
<a name="l00105"></a>00105 <span class="comment">// the file read pointer positioned at the start of a</span>
|
||||
<a name="l00106"></a>00106 <span class="comment">// variable-length value. The function returns true if the value is</span>
|
||||
<a name="l00107"></a>00107 <span class="comment">// successfully parsed. Otherwise, it returns false.</span>
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">bool</span> readVariableLength( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *value );
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a>00110 std::ifstream file_;
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks_;
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">int</span> format_;
|
||||
<a name="l00113"></a>00113 <span class="keywordtype">int</span> division_;
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">bool</span> usingTimeCode_;
|
||||
<a name="l00115"></a>00115 std::vector<double> tickSeconds_;
|
||||
<a name="l00116"></a>00116 std::vector<long> trackPointers_;
|
||||
<a name="l00117"></a>00117 std::vector<long> trackOffsets_;
|
||||
<a name="l00118"></a>00118 std::vector<long> trackLengths_;
|
||||
<a name="l00119"></a>00119 std::vector<char> trackStatus_;
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 <span class="comment">// This structure and the following variables are used to save and</span>
|
||||
<a name="l00122"></a>00122 <span class="comment">// keep track of a format 1 tempo map (and the initial tickSeconds</span>
|
||||
<a name="l00123"></a>00123 <span class="comment">// parameter for formats 0 and 2).</span>
|
||||
<a name="l00124"></a>00124 <span class="keyword">struct </span>TempoChange {
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count;
|
||||
<a name="l00126"></a>00126 <span class="keywordtype">double</span> tickSeconds;
|
||||
<a name="l00127"></a>00127 };
|
||||
<a name="l00128"></a>00128 std::vector<TempoChange> tempoEvents_;
|
||||
<a name="l00129"></a>00129 std::vector<unsigned long> trackCounters_;
|
||||
<a name="l00130"></a>00130 std::vector<unsigned int> trackTempoIndex_;
|
||||
<a name="l00131"></a>00131 };
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
55
doc/html/ModalBar_8h_source.html
Normal file
55
doc/html/ModalBar_8h_source.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ModalBar.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MODALBAR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODALBAR_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Modal.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_1ModalBar.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ModalBar.html" title="STK resonant bar instrument class.">ModalBar</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Modal.html" title="STK resonance model abstract base class.">Modal</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1ModalBar.html#a28577ea9c8c474eca560134d7991855d" title="Class constructor.">ModalBar</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1ModalBar.html#ab804e801a2d0b8e8c3552162152d6f3b" title="Class destructor.">~ModalBar</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#ad4fbd1f97cd8c8c0782827969b0b4acf" title="Set stick hardness (0.0 - 1.0).">setStickHardness</a>( StkFloat hardness );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#a5f0c4d254cb7efb87603a9732a072b38" title="Set stick position (0.0 - 1.0).">setStrikePosition</a>( StkFloat position );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#a3a09a114ccd420ab549b8565eb4928af" title="Select a bar preset (currently modulo 9).">setPreset</a>( <span class="keywordtype">int</span> preset );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#ae67fe1187b2e2018fd147c7e6293cde2" title="Set the modulation (vibrato) depth.">setModulationDepth</a>( StkFloat mDepth );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ModalBar.html#a84e5b9963b74f0e4657f79d5dea013cb" 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="l00061"></a>00061 };
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
145
doc/html/Modal_8h_source.html
Normal file
145
doc/html/Modal_8h_source.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.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#af6bfea135e80abb5537e62cf099c989a" 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#a7f45379ae10495b7a864cade0063705a" 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#af064dc6ee4290fd51b4a6dc8a1f0909d" 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#a503092926e66667227bb46312a82a264" 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#a7e4f9a875e60485d07d50386ff63117f" 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#a6e8d79358a5024b2e9a6c6f7c69a43c1">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#a6e8d79358a5024b2e9a6c6f7c69a43c1" 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#a70006135da2ecdc46eff4156504d94e1">00051</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modal.html#a70006135da2ecdc46eff4156504d94e1" 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#a08bdfedf10d00dcf19e82809926eab2f" 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#ab3bac00a47fa6fef70cf3ea442e9b121" 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#a1884c49b76ec8b902f22d50e26a7e365" 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#a44ce41e8e24e591f382914d00a259c7f" 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#a3483dafe33fa37e98781279810ea808f" 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#a9fab49ec164852c381758f5d333f8891" 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="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" 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="l00075"></a>00075
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <span class="keyword">protected</span>:
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> *wave_;
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> **filters_;
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> onepole_;
|
||||
<a name="l00090"></a>00090 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nModes_;
|
||||
<a name="l00093"></a>00093 std::vector<StkFloat> ratios_;
|
||||
<a name="l00094"></a>00094 std::vector<StkFloat> radii_;
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 StkFloat vibratoGain_;
|
||||
<a name="l00097"></a>00097 StkFloat masterGain_;
|
||||
<a name="l00098"></a>00098 StkFloat directGain_;
|
||||
<a name="l00099"></a>00099 StkFloat stickHardness_;
|
||||
<a name="l00100"></a>00100 StkFloat strikePosition_;
|
||||
<a name="l00101"></a>00101 StkFloat baseFrequency_;
|
||||
<a name="l00102"></a>00102 };
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">Modal :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 StkFloat temp = masterGain_ * onepole_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( wave_-><a class="code" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick</a>() * envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>() );
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 StkFloat temp2 = 0.0;
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<nModes_; i++ )
|
||||
<a name="l00110"></a>00110 temp2 += filters_[i]-><a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>(temp);
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a>00112 temp2 -= temp2 * directGain_;
|
||||
<a name="l00113"></a>00113 temp2 += directGain_ * temp;
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">if</span> ( vibratoGain_ != 0.0 ) {
|
||||
<a name="l00116"></a>00116 <span class="comment">// Calculate AM and apply to master out</span>
|
||||
<a name="l00117"></a>00117 temp = 1.0 + ( vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * vibratoGain_ );
|
||||
<a name="l00118"></a>00118 temp2 = temp * temp2;
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = temp2;
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a><a class="code" href="classstk_1_1Modal.html#ad2a28e7bd5fdae7d2a6d9fb79bbfb7b0">00125</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">Modal :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00126"></a>00126 {
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00130"></a>00130 oStream_ << <span class="stringliteral">"Modal::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></span>
|
||||
<a name="l00135"></a>00135 StkFloat *samples = &frames[channel];
|
||||
<a name="l00136"></a>00136 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00139"></a>00139 *samples++ = <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">else</span> {
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00143"></a>00143 *samples++ = <a class="code" href="classstk_1_1Modal.html#ac1fd3f5dcb9b5cbb8bed0bff330c3890" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00145"></a>00145 *samples++ = lastFrame_[j];
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
106
doc/html/Modulate_8h_source.html
Normal file
106
doc/html/Modulate_8h_source.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Modulate.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MODULATE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MODULATE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.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="l00021"></a>00021 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a><a class="code" href="classstk_1_1Modulate.html">00023</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Modulate.html" title="STK periodic/random modulator.">Modulate</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00024"></a>00024 {
|
||||
<a name="l00025"></a>00025 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00030"></a>00030 <a class="code" href="classstk_1_1Modulate.html#a96812173415bfb086f5d8d738f4d0c2e" title="Class constructor.">Modulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a>00033 <a class="code" href="classstk_1_1Modulate.html#add541ec0d037a21bd236b5790878d060" title="Class destructor.">~Modulate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1Modulate.html#a6cb78fe2dec3bebf2586764421556706">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#a6cb78fe2dec3bebf2586764421556706" title="Reset internal state.">reset</a>( <span class="keywordtype">void</span> ) { lastFrame_[0] = 0.0; };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Modulate.html#a298b25f4b7cc56f2dffae5474a05999d">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#a298b25f4b7cc56f2dffae5474a05999d" title="Set the periodic (vibrato) rate or frequency in Hz.">setVibratoRate</a>( StkFloat rate ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( rate ); };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Modulate.html#a08f2d489a3fba3a10d1f301aed869ed4">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#a08f2d489a3fba3a10d1f301aed869ed4" title="Set the periodic (vibrato) gain.">setVibratoGain</a>( StkFloat gain ) { vibratoGain_ = gain; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Modulate.html#ac6e7a02378facf59916f2460ed5c2fa5" title="Set the random modulation gain.">setRandomGain</a>( StkFloat gain );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Modulate.html#addf73f58590ab082f106c9745c5bedc9">00048</a> StkFloat <a class="code" href="classstk_1_1Modulate.html#addf73f58590ab082f106c9745c5bedc9" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 StkFloat <a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00061"></a>00061 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 <span class="keyword">protected</span>:
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00070"></a>00070 StkFloat vibratoGain_;
|
||||
<a name="l00071"></a>00071 StkFloat randomGain_;
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> noiseRate_;
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> noiseCounter_;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a><a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d">00077</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">Modulate :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00078"></a>00078 {
|
||||
<a name="l00079"></a>00079 <span class="comment">// Compute periodic and random modulations.</span>
|
||||
<a name="l00080"></a>00080 lastFrame_[0] = vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00081"></a>00081 <span class="keywordflow">if</span> ( noiseCounter_++ >= noiseRate_ ) {
|
||||
<a name="l00082"></a>00082 noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00083"></a>00083 noiseCounter_ = 0;
|
||||
<a name="l00084"></a>00084 }
|
||||
<a name="l00085"></a>00085 lastFrame_[0] += filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( noise_.<a class="code" href="classstk_1_1Noise.html#a1d6c8ed80425cd0cea014bd2e328c823" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00087"></a>00087 }
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1Modulate.html#a942eee1bb78318e1b59afeb311748b2d">00089</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">Modulate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00092"></a>00092 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 oStream_ << <span class="stringliteral">"Modulate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#endif</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span>
|
||||
<a name="l00098"></a>00098 StkFloat *samples = &frames[channel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00101"></a>00101 *samples = <a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">Modulate::tick</a>();
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
115
doc/html/Moog_8h_source.html
Normal file
115
doc/html/Moog_8h_source.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Moog.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MOOG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MOOG_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Sampler.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "FormSwep.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00027"></a>00027 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00029"></a><a class="code" href="classstk_1_1Moog.html">00029</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Moog.html" title="STK moog-like swept filter sampling synthesis class.">Moog</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Sampler.html" title="STK sampling synthesis abstract base class.">Sampler</a>
|
||||
<a name="l00030"></a>00030 {
|
||||
<a name="l00031"></a>00031 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1Moog.html#a07c8d02638711d5f08a3b320b7274156" title="Class constructor.">Moog</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1Moog.html#ac05815f49aab07e01ff0d4e5e8c4edba" title="Class destructor.">~Moog</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#ab0d66174dd734d55ef7224d6d8f2cb06" 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_1Moog.html#a899bc1c5c76fb29875d4df4ce594d44e" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Moog.html#afeb63bf762f07851db22ae5bf18f0a81">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#afeb63bf762f07851db22ae5bf18f0a81" title="Set the modulation (vibrato) speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { loops_[1]->setFrequency( mSpeed ); };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1Moog.html#a32e5ee083d5d92494bbe9fac43c2070f">00051</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#a32e5ee083d5d92494bbe9fac43c2070f" title="Set the modulation (vibrato) depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth * 0.5; };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Moog.html#acadb54eccab35e3b18b62ffd96c18ac4" 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="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 StkFloat <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <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_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> filters_[2];
|
||||
<a name="l00072"></a>00072 StkFloat modDepth_;
|
||||
<a name="l00073"></a>00073 StkFloat filterQ_;
|
||||
<a name="l00074"></a>00074 StkFloat filterRate_;
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 };
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a">00078</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">Moog :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00079"></a>00079 {
|
||||
<a name="l00080"></a>00080 StkFloat temp;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">if</span> ( modDepth_ != 0.0 ) {
|
||||
<a name="l00083"></a>00083 temp = loops_[1]->tick() * modDepth_;
|
||||
<a name="l00084"></a>00084 loops_[0]->setFrequency( baseFrequency_ * (1.0 + temp) );
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 temp = attackGain_ * attacks_[0]->tick();
|
||||
<a name="l00088"></a>00088 temp += loopGain_ * loops_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp = filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00090"></a>00090 temp *= adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00091"></a>00091 temp = filters_[0].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( temp );
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = filters_[1].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>( temp );
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">return</span> lastFrame_[0] * 6.0;
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a><a class="code" href="classstk_1_1Moog.html#aee6aa6373c424e941f963b2709310f4e">00096</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">Moog :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00097"></a>00097 {
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00101"></a>00101 oStream_ << <span class="stringliteral">"Moog::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#endif</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span>
|
||||
<a name="l00106"></a>00106 StkFloat *samples = &frames[channel];
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00110"></a>00110 *samples++ = <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">else</span> {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1Moog.html#ab9635044198c12a5c1b5dbb94245ab5a" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00116"></a>00116 *samples++ = lastFrame_[j];
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
76
doc/html/Mutex_8h_source.html
Normal file
76
doc/html/Mutex_8h_source.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Mutex.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_MUTEX_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_MUTEX_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor"> #include <pthread.h></span>
|
||||
<a name="l00009"></a>00009 <span class="keyword">typedef</span> pthread_mutex_t MUTEX;
|
||||
<a name="l00010"></a>00010 <span class="keyword">typedef</span> pthread_cond_t CONDITION;
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#elif defined(__OS_WINDOWS__)</span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor"></span>
|
||||
<a name="l00014"></a>00014 <span class="preprocessor"> #include <windows.h></span>
|
||||
<a name="l00015"></a>00015 <span class="preprocessor"> #include <process.h></span>
|
||||
<a name="l00016"></a>00016 <span class="keyword">typedef</span> CRITICAL_SECTION MUTEX;
|
||||
<a name="l00017"></a>00017 <span class="keyword">typedef</span> HANDLE CONDITION;
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a>00019 <span class="preprocessor">#endif</span>
|
||||
<a name="l00020"></a>00020 <span class="preprocessor"></span>
|
||||
<a name="l00021"></a>00021 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a>00023 <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_1Mutex.html">00036</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00037"></a>00037 {
|
||||
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1Mutex.html#a869b23f40be55c01cc381290de1d1375" title="Default constructor.">Mutex</a>();
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1Mutex.html#a63df62eabfb7976e34951145d7a7ced3" title="Class destructor.">~Mutex</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#af2bb62c13745502b58644189d1db5b35" title="Lock the mutex.">lock</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_1Mutex.html#ae518f6d3177dd8c2138eccb8944591ee" title="Unlock the mutex.">unlock</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#afa637fae8940d6c3ad42384439962bbe" title="Wait indefinitely on the mutex condition variable.">wait</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Mutex.html#ac3e3e69efa1587cb1f65fb645a8d43db" title="Signal the condition variable.">signal</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 MUTEX mutex_;
|
||||
<a name="l00068"></a>00068 CONDITION condition_;
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
135
doc/html/NRev_8h_source.html
Normal file
135
doc/html/NRev_8h_source.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>NRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_NREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_NREV_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1NRev.html">00025</a> <span class="keyword">class </span><a class="code" href="classstk_1_1NRev.html" title="CCRMA&#39;s NRev reverberator class.">NRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00026"></a>00026 {
|
||||
<a name="l00027"></a>00027 <span class="keyword">public</span>:
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1NRev.html#a68757d7a44e960acfd18cb94b465c727" title="Class constructor taking a T60 decay time argument (one second default value).">NRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1NRev.html#a4097b11b38dd00d084ae4a94bc18f02c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1NRev.html#a9c0d41a2b9ce7fb9edb2d620ba005e3c" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00046"></a>00046 StkFloat <a class="code" href="classstk_1_1NRev.html#a9f9faa6542271163680c1925309ed788" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00056"></a>00056 StkFloat <a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[8];
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[6];
|
||||
<a name="l00086"></a>00086 StkFloat allpassCoefficient_;
|
||||
<a name="l00087"></a>00087 StkFloat combCoefficient_[6];
|
||||
<a name="l00088"></a>00088 StkFloat lowpassState_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1NRev.html#a9f9faa6542271163680c1925309ed788">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1NRev.html#a9f9faa6542271163680c1925309ed788" title="Return the specified channel value of the last computed stereo frame.">NRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00095"></a>00095 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00096"></a>00096 oStream_ << <span class="stringliteral">"NRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#endif</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span>
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1NRev.html#acfb629e4822fc5bffcf39b8f3ed9cfa1" title="Input one sample to the effect and return the specified channel value of the computed...">NRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00108"></a>00108 oStream_ << <span class="stringliteral">"NRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00110"></a>00110 }
|
||||
<a name="l00111"></a>00111 <span class="preprocessor">#endif</span>
|
||||
<a name="l00112"></a>00112 <span class="preprocessor"></span>
|
||||
<a name="l00113"></a>00113 StkFloat temp, temp0, temp1, temp2, temp3;
|
||||
<a name="l00114"></a>00114 <span class="keywordtype">int</span> i;
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 temp0 = 0.0;
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( i=0; i<6; i++ ) {
|
||||
<a name="l00118"></a>00118 temp = input + (combCoefficient_[i] * combDelays_[i].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>());
|
||||
<a name="l00119"></a>00119 temp0 += combDelays_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">for</span> ( i=0; i<3; i++ ) {
|
||||
<a name="l00123"></a>00123 temp = allpassDelays_[i].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00124"></a>00124 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00125"></a>00125 temp1 += temp0;
|
||||
<a name="l00126"></a>00126 allpassDelays_[i].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00127"></a>00127 temp0 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00128"></a>00128 }
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130 <span class="comment">// One-pole lowpass filter.</span>
|
||||
<a name="l00131"></a>00131 lowpassState_ = 0.7 * lowpassState_ + 0.3 * temp0;
|
||||
<a name="l00132"></a>00132 temp = allpassDelays_[3].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00133"></a>00133 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00134"></a>00134 temp1 += lowpassState_;
|
||||
<a name="l00135"></a>00135 allpassDelays_[3].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( temp1 );
|
||||
<a name="l00136"></a>00136 temp1 = -( allpassCoefficient_ * temp1 ) + temp;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 temp = allpassDelays_[4].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00139"></a>00139 temp2 = allpassCoefficient_ * temp;
|
||||
<a name="l00140"></a>00140 temp2 += temp1;
|
||||
<a name="l00141"></a>00141 allpassDelays_[4].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( temp2 );
|
||||
<a name="l00142"></a>00142 lastFrame_[0] = effectMix_*( -( allpassCoefficient_ * temp2 ) + temp );
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 temp = allpassDelays_[5].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00145"></a>00145 temp3 = allpassCoefficient_ * temp;
|
||||
<a name="l00146"></a>00146 temp3 += temp1;
|
||||
<a name="l00147"></a>00147 allpassDelays_[5].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>( temp3 );
|
||||
<a name="l00148"></a>00148 lastFrame_[1] = effectMix_*( - ( allpassCoefficient_ * temp3 ) + temp );
|
||||
<a name="l00149"></a>00149
|
||||
<a name="l00150"></a>00150 temp = ( 1.0 - effectMix_ ) * input;
|
||||
<a name="l00151"></a>00151 lastFrame_[0] += temp;
|
||||
<a name="l00152"></a>00152 lastFrame_[1] += temp;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00155"></a>00155 }
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 <span class="preprocessor">#endif</span>
|
||||
<a name="l00160"></a>00160 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
81
doc/html/Noise_8h_source.html
Normal file
81
doc/html/Noise_8h_source.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Noise.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_NOISE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_NOISE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Generator.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Noise.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1Noise.html#a2d442a08883be25f10952dff4e515f98" title="Default constructor that can also take a specific seed value.">Noise</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seed = 0 );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00036"></a>00036 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Noise.html#a9507ae6eb261c577a64b4ecb5c1805dc" title="Seed the random number generator with a specific seed value.">setSeed</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> seed = 0 );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Noise.html#a1d6c8ed80425cd0cea014bd2e328c823">00039</a> StkFloat <a class="code" href="classstk_1_1Noise.html#a1d6c8ed80425cd0cea014bd2e328c823" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 StkFloat <a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00052"></a>00052 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00054"></a>00054 <span class="keyword">protected</span>:
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00056"></a>00056 };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00058"></a><a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d">00058</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">Noise :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00059"></a>00059 {
|
||||
<a name="l00060"></a>00060 <span class="keywordflow">return</span> lastFrame_[0] = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 );
|
||||
<a name="l00061"></a>00061 }
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1Noise.html#a2f92e91787dc19309305cf246632cd50">00063</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">Noise :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00064"></a>00064 {
|
||||
<a name="l00065"></a>00065 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00066"></a>00066 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00067"></a>00067 oStream_ << <span class="stringliteral">"Noise::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00068"></a>00068 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00069"></a>00069 }
|
||||
<a name="l00070"></a>00070 <span class="preprocessor">#endif</span>
|
||||
<a name="l00071"></a>00071 <span class="preprocessor"></span>
|
||||
<a name="l00072"></a>00072 StkFloat *samples = &frames[channel];
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00074"></a>00074 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00075"></a>00075 *samples = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00079"></a>00079 }
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
118
doc/html/OnePole_8h_source.html
Normal file
118
doc/html/OnePole_8h_source.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>OnePole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ONEPOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ONEPOLE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1OnePole.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1OnePole.html#ad0d322987780778e9f53f34837bea4b8" title="The default constructor creates a low-pass filter (pole at z = 0.9).">OnePole</a>( StkFloat thePole = 0.9 );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1OnePole.html#a03ac84c397620180090d86f2ecafccc5" title="Class destructor.">~OnePole</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1OnePole.html#aff587fbf5ba36b3dd24b2fb8d66b7e00">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#aff587fbf5ba36b3dd24b2fb8d66b7e00" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1OnePole.html#a1f99beebd9c4fbdfce6478e40d7625d8">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#a1f99beebd9c4fbdfce6478e40d7625d8" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#aa92dd54382721d5151ef29b291ba6cb5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat a1, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OnePole.html#acc1aaa35c6d5ffbbebfe0c4bfa7d1132" title="Set the pole position in the z-plane.">setPole</a>( StkFloat thePole );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1OnePole.html#ad1ad906374102791a01bfd60844028ec">00051</a> StkFloat <a class="code" href="classstk_1_1OnePole.html#ad1ad906374102791a01bfd60844028ec" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 StkFloat <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a><a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e">00080</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">OnePole :: tick</a>( StkFloat input )
|
||||
<a name="l00081"></a>00081 {
|
||||
<a name="l00082"></a>00082 inputs_[0] = gain_ * input;
|
||||
<a name="l00083"></a>00083 lastFrame_[0] = b_[0] * inputs_[0] - a_[1] * outputs_[1];
|
||||
<a name="l00084"></a>00084 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00087"></a>00087 }
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1OnePole.html#af6611322a3c17f728cf6d57a4f932a1f">00089</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">OnePole :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00092"></a>00092 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 oStream_ << <span class="stringliteral">"OnePole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#endif</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span>
|
||||
<a name="l00098"></a>00098 StkFloat *samples = &frames[channel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00101"></a>00101 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00102"></a>00102 *samples = b_[0] * inputs_[0] - a_[1] * outputs_[1];
|
||||
<a name="l00103"></a>00103 outputs_[1] = *samples;
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00107"></a>00107 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109
|
||||
<a name="l00110"></a><a class="code" href="classstk_1_1OnePole.html#a495943f1659f2da6208703a24275defb">00110</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">OnePole :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00111"></a>00111 {
|
||||
<a name="l00112"></a>00112 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00113"></a>00113 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00114"></a>00114 oStream_ << <span class="stringliteral">"OnePole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00115"></a>00115 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00116"></a>00116 }
|
||||
<a name="l00117"></a>00117 <span class="preprocessor">#endif</span>
|
||||
<a name="l00118"></a>00118 <span class="preprocessor"></span>
|
||||
<a name="l00119"></a>00119 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00120"></a>00120 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00121"></a>00121 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00123"></a>00123 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00124"></a>00124 *oSamples = b_[0] * inputs_[0] - a_[1] * outputs_[1];
|
||||
<a name="l00125"></a>00125 outputs_[1] = *oSamples;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
119
doc/html/OneZero_8h_source.html
Normal file
119
doc/html/OneZero_8h_source.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>OneZero.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_ONEZERO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_ONEZERO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1OneZero.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1OneZero.html#ada639198d28be5d170508a301ba854da" title="The default constructor creates a low-pass filter (zero at z = -1.0).">OneZero</a>( StkFloat theZero = -1.0 );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1OneZero.html#a8abe6156bad57d3a5cfebcf2ddc9b703" title="Class destructor.">~OneZero</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1OneZero.html#aef2a8aa1759762649a74fc031198ebca">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#aef2a8aa1759762649a74fc031198ebca" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1OneZero.html#ad4eda332f920e43a33871c8beb6f3042">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#ad4eda332f920e43a33871c8beb6f3042" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#a6113bf1dce0cb23719e30ee29e7c6735" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1OneZero.html#af8301fdb6a893ec6eb74fbcbeeaa463c" title="Set the zero position in the z-plane.">setZero</a>( StkFloat theZero );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a><a class="code" href="classstk_1_1OneZero.html#a54e160f62354939876477d9c5a65890c">00050</a> StkFloat <a class="code" href="classstk_1_1OneZero.html#a54e160f62354939876477d9c5a65890c" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 StkFloat <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00064"></a>00064 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 };
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a><a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da">00079</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">OneZero :: tick</a>( StkFloat input )
|
||||
<a name="l00080"></a>00080 {
|
||||
<a name="l00081"></a>00081 inputs_[0] = gain_ * input;
|
||||
<a name="l00082"></a>00082 lastFrame_[0] = b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00083"></a>00083 inputs_[1] = inputs_[0];
|
||||
<a name="l00084"></a>00084
|
||||
<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><a class="code" href="classstk_1_1OneZero.html#a2ca42a158bed919d8578c4a2dd184b3d">00088</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">OneZero :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00089"></a>00089 {
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00092"></a>00092 oStream_ << <span class="stringliteral">"OneZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span>
|
||||
<a name="l00097"></a>00097 StkFloat *samples = &frames[channel];
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00100"></a>00100 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00101"></a>00101 *samples = b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00102"></a>00102 inputs_[1] = inputs_[0];
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a><a class="code" href="classstk_1_1OneZero.html#a8568a0d8c4aacc64b656b9fe46f217a4">00109</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">OneZero :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00110"></a>00110 {
|
||||
<a name="l00111"></a>00111 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00112"></a>00112 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00113"></a>00113 oStream_ << <span class="stringliteral">"OneZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00114"></a>00114 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></span>
|
||||
<a name="l00118"></a>00118 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00119"></a>00119 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00122"></a>00122 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00123"></a>00123 *oSamples = b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00124"></a>00124 inputs_[1] = inputs_[0];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00129"></a>00129 }
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
116
doc/html/PRCRev_8h_source.html
Normal file
116
doc/html/PRCRev_8h_source.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PRCRev.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PRCREV_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PRCREV_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Delay.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1PRCRev.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PRCRev.html" title="Perry&#39;s simple reverberator class.">PRCRev</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1PRCRev.html#afb6440fb909a3091f21f31f3565014de" title="Class constructor taking a T60 decay time argument (one second default value).">PRCRev</a>( StkFloat T60 = 1.0 );
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PRCRev.html#a3e2fa911784a02a6d7211cbe2348ffe1" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PRCRev.html#a9478ed84e76d12cc66d11716ebfa8b3b" title="Set the reverberation T60 decay time.">setT60</a>( StkFloat T60 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00045"></a>00045 StkFloat <a class="code" href="classstk_1_1PRCRev.html#a47ed5fee4401f0050d6a47d1154e81c6" title="Return the specified channel value of the last computed stereo frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00055"></a>00055 StkFloat <a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6" title="Input one sample to the effect and return the specified channel value of the computed...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <span class="keyword">protected</span>:
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> allpassDelays_[2];
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Delay.html" title="STK non-interpolating delay line class.">Delay</a> combDelays_[2];
|
||||
<a name="l00085"></a>00085 StkFloat allpassCoefficient_;
|
||||
<a name="l00086"></a>00086 StkFloat combCoefficient_[2];
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 };
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a><a class="code" href="classstk_1_1PRCRev.html#a47ed5fee4401f0050d6a47d1154e81c6">00090</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PRCRev.html#a47ed5fee4401f0050d6a47d1154e81c6" title="Return the specified channel value of the last computed stereo frame.">PRCRev :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00091"></a>00091 {
|
||||
<a name="l00092"></a>00092 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00093"></a>00093 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00094"></a>00094 oStream_ << <span class="stringliteral">"PRCRev::lastOut(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097 <span class="preprocessor">#endif</span>
|
||||
<a name="l00098"></a>00098 <span class="preprocessor"></span>
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00100"></a>00100 }
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a><a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6">00102</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PRCRev.html#ada84d5241777575b660db100a85b35a6" title="Input one sample to the effect and return the specified channel value of the computed...">PRCRev :: tick</a>( StkFloat input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00103"></a>00103 {
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > 1 ) {
|
||||
<a name="l00106"></a>00106 oStream_ << <span class="stringliteral">"PRCRev::tick(): channel argument must be less than 2!"</span>;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#endif</span>
|
||||
<a name="l00110"></a>00110 <span class="preprocessor"></span>
|
||||
<a name="l00111"></a>00111 StkFloat temp, temp0, temp1, temp2, temp3;
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 temp = allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00114"></a>00114 temp0 = allpassCoefficient_ * temp;
|
||||
<a name="l00115"></a>00115 temp0 += input;
|
||||
<a name="l00116"></a>00116 allpassDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp0);
|
||||
<a name="l00117"></a>00117 temp0 = -(allpassCoefficient_ * temp0) + temp;
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a>00119 temp = allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00120"></a>00120 temp1 = allpassCoefficient_ * temp;
|
||||
<a name="l00121"></a>00121 temp1 += temp0;
|
||||
<a name="l00122"></a>00122 allpassDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp1);
|
||||
<a name="l00123"></a>00123 temp1 = -(allpassCoefficient_ * temp1) + temp;
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 temp2 = temp1 + ( combCoefficient_[0] * combDelays_[0].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00126"></a>00126 temp3 = temp1 + ( combCoefficient_[1] * combDelays_[1].<a class="code" href="classstk_1_1Delay.html#a7b563a37eec1773e8e82f9e328aed9b2" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = effectMix_ * (combDelays_[0].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp2));
|
||||
<a name="l00129"></a>00129 lastFrame_[1] = effectMix_ * (combDelays_[1].<a class="code" href="classstk_1_1Delay.html#aa1a929e0e324417b8a55cbf8770532e9" title="Input one sample to the filter and return one output.">tick</a>(temp3));
|
||||
<a name="l00130"></a>00130 temp = (1.0 - effectMix_) * input;
|
||||
<a name="l00131"></a>00131 lastFrame_[0] += temp;
|
||||
<a name="l00132"></a>00132 lastFrame_[1] += temp;
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a>00137 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
112
doc/html/PercFlut_8h_source.html
Normal file
112
doc/html/PercFlut_8h_source.html
Normal file
@@ -0,0 +1,112 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.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#ab51f05b79d818ed8ba80fd827a4839c2" 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#add2a18e8835d665d505521e0298bd2f0" 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#a24197fb4ae0bf806d8e3f6fe4eb5598c" 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#a7ebfc19d4c41482a699f43b2c06dc02d" 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#ac2b2958902c044413a1c7ff3bd0f8054" 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="l00058"></a>00058
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <span class="keyword">protected</span>:
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054">00071</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">PercFlut :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00072"></a>00072 {
|
||||
<a name="l00073"></a>00073 <span class="keyword">register</span> StkFloat temp;
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 temp = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_ * 0.2;
|
||||
<a name="l00076"></a>00076 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
<a name="l00077"></a>00077 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
<a name="l00078"></a>00078 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
<a name="l00079"></a>00079 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00082"></a>00082 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00085"></a>00085 waves_[2]->addPhaseOffset( temp );
|
||||
<a name="l00086"></a>00086 temp = (1.0 - (control2_ * 0.5)) * gains_[2] * adsr_[2]-><a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>() * waves_[2]->tick();
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00089"></a>00089 temp = temp * control1_;
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 waves_[0]->addPhaseOffset(temp);
|
||||
<a name="l00092"></a>00092 temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1PercFlut.html#a4105b2b1dfe375bcf870fb4903509e4e">00098</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">PercFlut :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"PercFlut::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00112"></a>00112 *samples++ = <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">else</span> {
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00116"></a>00116 *samples++ = <a class="code" href="classstk_1_1PercFlut.html#ac2b2958902c044413a1c7ff3bd0f8054" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00118"></a>00118 *samples++ = lastFrame_[j];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
64
doc/html/Phonemes_8h_source.html
Normal file
64
doc/html/Phonemes_8h_source.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Phonemes.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PHONEMES_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PHONEMES_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Phonemes.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Phonemes.html" title="STK phonemes table.">Phonemes</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a>00024 <a class="code" href="classstk_1_1Phonemes.html" title="STK phonemes table.">Phonemes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00026"></a>00026 ~<a class="code" href="classstk_1_1Phonemes.html" title="STK phonemes table.">Phonemes</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classstk_1_1Phonemes.html#a8b1a29ac4e6ddb629154d298d5abf585" title="Returns the phoneme name for the given index (0-31).">name</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a3e4cded114bb563bc78412c7b6b1d099" title="Returns the voiced component gain for the given phoneme index (0-31).">voiceGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a57715042b02c835da194753bc8f8a99e" title="Returns the unvoiced component gain for the given phoneme index (0-31).">noiseGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a1234a72b76a952865642c783e80d4d84" title="Returns the formant frequency for the given phoneme index (0-31) and partial (0-3)...">formantFrequency</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> partial );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#aaa22b87de100770a4995632932c324bb" title="Returns the formant radius for the given phoneme index (0-31) and partial (0-3).">formantRadius</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> partial );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Phonemes.html#a212b5fd0d61c8e4b08a78bb9912f7903" title="Returns the formant gain for the given phoneme index (0-31) and partial (0-3).">formantGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> partial );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00046"></a>00046 <span class="keyword">private</span>:
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00048"></a>00048 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> phonemeNames[][4];
|
||||
<a name="l00049"></a>00049 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat phonemeGains[][2];
|
||||
<a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keyword">const</span> StkFloat phonemeParameters[][4][3];
|
||||
<a name="l00051"></a>00051 };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00053"></a>00053 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00055"></a>00055 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
102
doc/html/PitShift_8h_source.html
Normal file
102
doc/html/PitShift_8h_source.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PitShift.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PITSHIFT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PITSHIFT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Effect.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a>00020 <span class="keyword">const</span> <span class="keywordtype">int</span> maxDelay = 5024;
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1PitShift.html">00022</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PitShift.html" title="STK simple pitch shifter effect class.">PitShift</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Effect.html" title="STK abstract effects parent class.">Effect</a>
|
||||
<a name="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1PitShift.html#a8fdf3ef3b1a94e126a2953c6b8ed8cca" title="Class constructor.">PitShift</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PitShift.html#afa1b0ff95ef9a22991525f72d703220e" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PitShift.html#a1ade8534def67636af6f0d7e50825891" title="Set the pitch shift factor (1.0 produces no shift).">setShift</a>( StkFloat shift );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1PitShift.html#a782ad7b47c450c1584cebd20570f17e3">00035</a> StkFloat <a class="code" href="classstk_1_1PitShift.html#a782ad7b47c450c1584cebd20570f17e3" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 StkFloat <a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" title="Input one sample to the effect and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00049"></a>00049 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" title="Input one sample to the effect and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keyword">protected</span>:
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delayLine_[2];
|
||||
<a name="l00065"></a>00065 StkFloat delay_[2];
|
||||
<a name="l00066"></a>00066 StkFloat env_[2];
|
||||
<a name="l00067"></a>00067 StkFloat rate_;
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delayLength_;
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> halfLength_;
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033">00073</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PitShift.html#a433fcd3da3e7b08cb8b3392865e93033" title="Input one sample to the effect and return one output.">PitShift :: tick</a>( StkFloat input )
|
||||
<a name="l00074"></a>00074 {
|
||||
<a name="l00075"></a>00075 <span class="comment">// Calculate the two delay length values, keeping them within the</span>
|
||||
<a name="l00076"></a>00076 <span class="comment">// range 12 to maxDelay-12.</span>
|
||||
<a name="l00077"></a>00077 delay_[0] += rate_;
|
||||
<a name="l00078"></a>00078 <span class="keywordflow">while</span> ( delay_[0] > maxDelay-12 ) delay_[0] -= delayLength_;
|
||||
<a name="l00079"></a>00079 <span class="keywordflow">while</span> ( delay_[0] < 12 ) delay_[0] += delayLength_;
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 delay_[1] = delay_[0] + halfLength_;
|
||||
<a name="l00082"></a>00082 <span class="keywordflow">while</span> ( delay_[1] > maxDelay-12 ) delay_[1] -= delayLength_;
|
||||
<a name="l00083"></a>00083 <span class="keywordflow">while</span> ( delay_[1] < 12 ) delay_[1] += delayLength_;
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00085"></a>00085 <span class="comment">// Set the new delay line lengths.</span>
|
||||
<a name="l00086"></a>00086 delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( delay_[0] );
|
||||
<a name="l00087"></a>00087 delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a80dd30628502a7c3b37ff045176eb91f" title="Set the delay-line length.">setDelay</a>( delay_[1] );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="comment">// Calculate a triangular envelope.</span>
|
||||
<a name="l00090"></a>00090 env_[1] = fabs( ( delay_[0] - halfLength_ + 12 ) * ( 1.0 / (halfLength_ + 12 ) ) );
|
||||
<a name="l00091"></a>00091 env_[0] = 1.0 - env_[1];
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="comment">// Delay input and apply envelope.</span>
|
||||
<a name="l00094"></a>00094 lastFrame_[0] = env_[0] * delayLine_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input );
|
||||
<a name="l00095"></a>00095 lastFrame_[0] += env_[1] * delayLine_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( input );
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 <span class="comment">// Compute effect mix and output.</span>
|
||||
<a name="l00098"></a>00098 lastFrame_[0] *= effectMix_;
|
||||
<a name="l00099"></a>00099 lastFrame_[0] += ( 1.0 - effectMix_ ) * input;
|
||||
<a name="l00100"></a>00100
|
||||
<a name="l00101"></a>00101 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/Plucked_8h_source.html
Normal file
107
doc/html/Plucked_8h_source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Plucked.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_PLUCKED_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_PLUCKED_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 "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Plucked.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Plucked.html" title="STK basic plucked string class.">Plucked</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Plucked.html#a65eee23eda411e7fd82bf4a555d8dd85" title="Class constructor, taking the lowest desired playing frequency.">Plucked</a>( StkFloat lowestFrequency = 10.0 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Plucked.html#a6232b4a1ed48407fe9e66e1835011b5e" title="Class destructor.">~Plucked</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#a32a7063198af354fc007e3d903e21208" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#a1864c705b85633542621ba3ba4491331" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#a9c8741ae249b590d24937743caf11f6c" title="Pluck the string with the given amplitude using the current frequency.">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#a1a8ce6b094c8e2b5c6dda805c032cd44" 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 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Plucked.html#aba5a6b6850874da55c32388e9857d6fc" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keyword">protected</span>:
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> loopFilter_;
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> pickFilter_;
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 StkFloat loopGain_;
|
||||
<a name="l00079"></a>00079 };
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a><a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25">00081</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">Plucked :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="comment">// Here's the whole inner loop of the instrument!!</span>
|
||||
<a name="l00084"></a>00084 <span class="keywordflow">return</span> lastFrame_[0] = 3.0 * delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( loopFilter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_ ) );
|
||||
<a name="l00085"></a>00085 }
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a><a class="code" href="classstk_1_1Plucked.html#ab9bb602c6f6867cf00995bc42101c006">00087</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">Plucked :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00088"></a>00088 {
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00091"></a>00091 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00092"></a>00092 oStream_ << <span class="stringliteral">"Plucked::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
|
||||
<a name="l00096"></a>00096 <span class="preprocessor"></span>
|
||||
<a name="l00097"></a>00097 StkFloat *samples = &frames[channel];
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00101"></a>00101 *samples++ = <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00102"></a>00102 }
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">else</span> {
|
||||
<a name="l00104"></a>00104 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00105"></a>00105 *samples++ = <a class="code" href="classstk_1_1Plucked.html#adb4a5d731ad2b680120313f03a020c25" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00106"></a>00106 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00107"></a>00107 *samples++ = lastFrame_[j];
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 <span class="preprocessor">#endif</span>
|
||||
<a name="l00117"></a>00117 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
100
doc/html/PoleZero_8h_source.html
Normal file
100
doc/html/PoleZero_8h_source.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>PoleZero.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_POLEZERO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_POLEZERO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00019"></a>00019 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a><a class="code" href="classstk_1_1PoleZero.html">00021</a> <span class="keyword">class </span><a class="code" href="classstk_1_1PoleZero.html" title="STK one-pole, one-zero filter class.">PoleZero</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00022"></a>00022 {
|
||||
<a name="l00023"></a>00023 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1PoleZero.html#ad9a46d21ee470d7afcd641807b5e314e" title="Default constructor creates a first-order pass-through filter.">PoleZero</a>();
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1PoleZero.html#abeb7feab68b5d8370bd9c2aef94c8541" title="Class destructor.">~PoleZero</a>();
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1PoleZero.html#a8e4a45e4a5263c66e9d447688975ca0f">00032</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#a8e4a45e4a5263c66e9d447688975ca0f" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a><a class="code" href="classstk_1_1PoleZero.html#ae33d1e1f594b4cf9063518c7b065c5f5">00035</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#ae33d1e1f594b4cf9063518c7b065c5f5" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1PoleZero.html#ae3f0fc1182eb06730f09b8137c01779f">00038</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#ae3f0fc1182eb06730f09b8137c01779f" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#af34e485fbcaa1f4985a88a882ca9d5c5" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat a1, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#a51264d601b635aa0274c75ba1aa5a048" title="Set the filter for allpass behavior using coefficient.">setAllpass</a>( StkFloat coefficient );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1PoleZero.html#acb7119d8964215546bbeeb6029f5c46f" title="Create a DC blocking filter with the given pole position in the z-plane.">setBlockZero</a>( StkFloat thePole = 0.99 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a><a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232">00062</a> StkFloat <a class="code" href="classstk_1_1PoleZero.html#a03edf036d1619bb5d33bb41701833232" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065 StkFloat <a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00075"></a>00075 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 };
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a><a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228">00079</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">PoleZero :: tick</a>( StkFloat input )
|
||||
<a name="l00080"></a>00080 {
|
||||
<a name="l00081"></a>00081 inputs_[0] = gain_ * input;
|
||||
<a name="l00082"></a>00082 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] - a_[1] * outputs_[1];
|
||||
<a name="l00083"></a>00083 inputs_[1] = inputs_[0];
|
||||
<a name="l00084"></a>00084 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00087"></a>00087 }
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a><a class="code" href="classstk_1_1PoleZero.html#a1b5e97a13c582d97cfaa7fcbd4211b47">00089</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1PoleZero.html#a1a29ac6f3a2b75e71693c73554599228" title="Input one sample to the filter and return one output.">PoleZero :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00090"></a>00090 {
|
||||
<a name="l00091"></a>00091 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00092"></a>00092 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00093"></a>00093 oStream_ << <span class="stringliteral">"PoleZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00095"></a>00095 }
|
||||
<a name="l00096"></a>00096 <span class="preprocessor">#endif</span>
|
||||
<a name="l00097"></a>00097 <span class="preprocessor"></span>
|
||||
<a name="l00098"></a>00098 StkFloat *samples = &frames[channel];
|
||||
<a name="l00099"></a>00099 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00100"></a>00100 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00101"></a>00101 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00102"></a>00102 *samples = b_[0] * inputs_[0] + b_[1] * inputs_[1] - a_[1] * outputs_[1];
|
||||
<a name="l00103"></a>00103 inputs_[1] = inputs_[0];
|
||||
<a name="l00104"></a>00104 outputs_[1] = *samples;
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00109"></a>00109 }
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
123
doc/html/ReedTable_8h_source.html
Normal file
123
doc/html/ReedTable_8h_source.html
Normal file
@@ -0,0 +1,123 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>ReedTable.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_REEDTABLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_REEDTABLE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Function.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="l00025"></a>00025 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1ReedTable.html">00027</a> <span class="keyword">class </span><a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Function.html" title="STK abstract function parent class.">Function</a>
|
||||
<a name="l00028"></a>00028 {
|
||||
<a name="l00029"></a>00029 <span class="keyword">public</span>:
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1ReedTable.html#a138db7619ec28a4feeaf2a00988e4f0d">00031</a> <a class="code" href="classstk_1_1ReedTable.html#a138db7619ec28a4feeaf2a00988e4f0d" title="Default constructor.">ReedTable</a>( <span class="keywordtype">void</span> ) : offset_(0.6), slope_(-0.8) {};
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1ReedTable.html#ab40ffd675bd7242a210e8630f8919556">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ReedTable.html#ab40ffd675bd7242a210e8630f8919556" title="Set the table offset value.">setOffset</a>( StkFloat offset ) { offset_ = offset; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00047"></a><a class="code" href="classstk_1_1ReedTable.html#a968a97400ec6bd424634ff377fc6417a">00047</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1ReedTable.html#a968a97400ec6bd424634ff377fc6417a" title="Set the table slope value.">setSlope</a>( StkFloat slope ) { slope_ = slope; };
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 StkFloat <a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( StkFloat input );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00061"></a>00061 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 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 StkFloat offset_;
|
||||
<a name="l00077"></a>00077 StkFloat slope_;
|
||||
<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_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2">00081</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">ReedTable :: tick</a>( StkFloat input )
|
||||
<a name="l00082"></a>00082 {
|
||||
<a name="l00083"></a>00083 <span class="comment">// The input is differential pressure across the reed.</span>
|
||||
<a name="l00084"></a>00084 lastFrame_[0] = offset_ + (slope_ * input);
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="comment">// If output is > 1, the reed has slammed shut and the</span>
|
||||
<a name="l00087"></a>00087 <span class="comment">// reflection function value saturates at 1.0.</span>
|
||||
<a name="l00088"></a>00088 <span class="keywordflow">if</span> ( lastFrame_[0] > 1.0) lastFrame_[0] = (StkFloat) 1.0;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="comment">// This is nearly impossible in a physical system, but</span>
|
||||
<a name="l00091"></a>00091 <span class="comment">// a reflection function value of -1.0 corresponds to</span>
|
||||
<a name="l00092"></a>00092 <span class="comment">// an open end (and no discontinuity in bore profile).</span>
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">if</span> ( lastFrame_[0] < -1.0) lastFrame_[0] = (StkFloat) -1.0;
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1ReedTable.html#a3455fa2dedb2c86fc825ec48296822be">00098</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">ReedTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00101"></a>00101 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00102"></a>00102 oStream_ << <span class="stringliteral">"ReedTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105 <span class="preprocessor">#endif</span>
|
||||
<a name="l00106"></a>00106 <span class="preprocessor"></span>
|
||||
<a name="l00107"></a>00107 StkFloat *samples = &frames[channel];
|
||||
<a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00110"></a>00110 *samples = offset_ + (slope_ * *samples);
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( *samples > 1.0) *samples = 1.0;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">if</span> ( *samples < -1.0) *samples = -1.0;
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a>00115 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118
|
||||
<a name="l00119"></a><a class="code" href="classstk_1_1ReedTable.html#ae682fdc0a6ec68a9f858f5cd6889113d">00119</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">ReedTable :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00120"></a>00120 {
|
||||
<a name="l00121"></a>00121 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00122"></a>00122 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00123"></a>00123 oStream_ << <span class="stringliteral">"ReedTable::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00124"></a>00124 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#endif</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span>
|
||||
<a name="l00128"></a>00128 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00129"></a>00129 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00132"></a>00132 *oSamples = offset_ + (slope_ * *iSamples);
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">if</span> ( *oSamples > 1.0) *oSamples = 1.0;
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">if</span> ( *oSamples < -1.0) *oSamples = -1.0;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a>00137 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140
|
||||
<a name="l00141"></a>00141 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
116
doc/html/Resonate_8h_source.html
Normal file
116
doc/html/Resonate_8h_source.html
Normal file
@@ -0,0 +1,116 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.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="l00070"></a>00070
|
||||
<a name="l00077"></a>00077 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <span class="keyword">protected</span>:
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> filter_;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00084"></a>00084 StkFloat poleFrequency_;
|
||||
<a name="l00085"></a>00085 StkFloat poleRadius_;
|
||||
<a name="l00086"></a>00086 StkFloat zeroFrequency_;
|
||||
<a name="l00087"></a>00087 StkFloat zeroRadius_;
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 };
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a><a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98">00091</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="l00092"></a>00092 {
|
||||
<a name="l00093"></a>00093 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="l00094"></a>00094 lastFrame_[0] *= adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00095"></a>00095 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00096"></a>00096 }
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a><a class="code" href="classstk_1_1Resonate.html#aeefb870c1eeb430160fdca374e8324b3">00098</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98" title="Compute and return one output sample.">Resonate :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00099"></a>00099 {
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00101"></a>00101 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00102"></a>00102 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00103"></a>00103 oStream_ << <span class="stringliteral">"Resonate::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00105"></a>00105 }
|
||||
<a name="l00106"></a>00106 <span class="preprocessor">#endif</span>
|
||||
<a name="l00107"></a>00107 <span class="preprocessor"></span>
|
||||
<a name="l00108"></a>00108 StkFloat *samples = &frames[channel];
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00110"></a>00110 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00112"></a>00112 *samples++ = <a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113 }
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">else</span> {
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00116"></a>00116 *samples++ = <a class="code" href="classstk_1_1Resonate.html#ab917279f4f57d5d305481426e9bffd98" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00118"></a>00118 *samples++ = lastFrame_[j];
|
||||
<a name="l00119"></a>00119 }
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
109
doc/html/Rhodey_8h_source.html
Normal file
109
doc/html/Rhodey_8h_source.html
Normal file
@@ -0,0 +1,109 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Rhodey.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_RHODEY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_RHODEY_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_1Rhodey.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Rhodey.html" title="STK Fender Rhodes electric piano FM synthesis instrument.">Rhodey</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_1Rhodey.html#ab647310b8bfc12b518b5c3a89db6d94e" title="Class constructor.">Rhodey</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1Rhodey.html#a6fc6c7473cef051e11a62802848b228c" title="Class destructor.">~Rhodey</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_1Rhodey.html#a216ff771d88e7e03c46bc477d7ed5e86" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Rhodey.html#a98e112778609f8eb217c0956f17c65e4" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keyword">protected</span>:
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790">00075</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">Rhodey :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00076"></a>00076 {
|
||||
<a name="l00077"></a>00077 StkFloat temp, temp2;
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00080"></a>00080 temp = temp * control1_;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00083"></a>00083 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00084"></a>00084 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00085"></a>00085 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 waves_[2]->addPhaseOffset( temp );
|
||||
<a name="l00088"></a>00088 temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]-><a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">tick</a>() * waves_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">// Calculate amplitude modulation and apply it to output.</span>
|
||||
<a name="l00092"></a>00092 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_;
|
||||
<a name="l00093"></a>00093 temp = temp * (1.0 + temp2);
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Rhodey.html#a9d843b764e5219c8289884d0903462f9">00099</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">Rhodey :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <span class="stringliteral">"Rhodey::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00113"></a>00113 *samples++ = <a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00114"></a>00114 }
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">else</span> {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00117"></a>00117 *samples++ = <a class="code" href="classstk_1_1Rhodey.html#a199591ffb4230c653ec7d7ea52e37790" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00119"></a>00119 *samples++ = lastFrame_[j];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
147
doc/html/RtAudio_8h.html
Normal file
147
doc/html/RtAudio_8h.html
Normal file
@@ -0,0 +1,147 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>RtAudio.h File Reference</h1>
|
||||
<p><a href="RtAudio_8h_source.html">Go to the source code of this file.</a></p>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td colspan="2"><h2>Classes</h2></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classRtAudio.html">RtAudio</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">Realtime audio i/o C++ classes. <a href="classRtAudio.html#_details">More...</a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">The public device information structure for returning queried values. <a href="structRtAudio_1_1DeviceInfo.html#_details">More...</a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structRtAudio_1_1StreamParameters.html">RtAudio::StreamParameters</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">The structure for specifying input or ouput stream parameters. <a href="structRtAudio_1_1StreamParameters.html#_details">More...</a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structRtAudio_1_1StreamOptions.html">RtAudio::StreamOptions</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight">The structure for specifying stream options. <a href="structRtAudio_1_1StreamOptions.html#_details">More...</a><br/></td></tr>
|
||||
<tr><td colspan="2"><h2>Typedefs</h2></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">typedef unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8">RtAudioFormat</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> data format type. <a href="#aafca92882d25915560018873221e44b8"></a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">typedef unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41">RtAudioStreamFlags</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream option flags. <a href="#a2c0f59b200dcec4d4e760f9166b29c41"></a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">typedef unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a></td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream status (over- or underflow) flags. <a href="#a80e306d363583da3b0a1b65d9b57c806"></a><br/></td></tr>
|
||||
<tr><td class="memItemLeft" align="right" valign="top">typedef int(* </td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f">RtAudioCallback</a> )(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, <a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a> status, void *userData)</td></tr>
|
||||
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> callback function prototype. <a href="#a112c7b7e25a974977f6fc094cef1a31f"></a><br/></td></tr>
|
||||
</table>
|
||||
<hr/><a name="_details"></a><h2>Detailed Description</h2>
|
||||
<hr/><h2>Typedef Documentation</h2>
|
||||
<a class="anchor" id="aafca92882d25915560018873221e44b8"></a><!-- doxytag: member="RtAudio.h::RtAudioFormat" ref="aafca92882d25915560018873221e44b8" args="" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">typedef unsigned long <a class="el" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8">RtAudioFormat</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> data format type. </p>
|
||||
<p>Support for signed integers and floats. Audio data fed to/from an <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream is assumed to ALWAYS be in host byte order. The internal routines will automatically take care of any necessary byte-swapping between the host format and the soundcard. Thus, endian-ness is not a concern in the following format definitions. Note that 24-bit data is expected to be encapsulated in a 32-bit format.</p>
|
||||
<ul>
|
||||
<li><em>RTAUDIO_SINT8:</em> 8-bit signed integer.</li>
|
||||
<li><em>RTAUDIO_SINT16:</em> 16-bit signed integer.</li>
|
||||
<li><em>RTAUDIO_SINT24:</em> Lower 3 bytes of 32-bit signed integer.</li>
|
||||
<li><em>RTAUDIO_SINT32:</em> 32-bit signed integer.</li>
|
||||
<li><em>RTAUDIO_FLOAT32:</em> Normalized between plus/minus 1.0.</li>
|
||||
<li><em>RTAUDIO_FLOAT64:</em> Normalized between plus/minus 1.0. </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a class="anchor" id="a2c0f59b200dcec4d4e760f9166b29c41"></a><!-- doxytag: member="RtAudio.h::RtAudioStreamFlags" ref="a2c0f59b200dcec4d4e760f9166b29c41" args="" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">typedef unsigned long <a class="el" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41">RtAudioStreamFlags</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream option flags. </p>
|
||||
<p>The following flags can be OR'ed together to allow a client to make changes to the default stream behavior:</p>
|
||||
<ul>
|
||||
<li><em>RTAUDIO_NONINTERLEAVED:</em> Use non-interleaved buffers (default = interleaved).</li>
|
||||
<li><em>RTAUDIO_MINIMIZE_LATENCY:</em> Attempt to set stream parameters for lowest possible latency.</li>
|
||||
<li><em>RTAUDIO_HOG_DEVICE:</em> Attempt grab device for exclusive use.</li>
|
||||
<li><em>RTAUDIO_ALSA_USE_DEFAULT:</em> Use the "default" PCM device (ALSA only).</li>
|
||||
</ul>
|
||||
<p>By default, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> streams pass and receive audio data from the client in an interleaved format. By passing the RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio data will instead be presented in non-interleaved buffers. In this case, each buffer argument in the RtAudioCallback function will point to a single array of data, with <code>nFrames</code> samples for each channel concatenated back-to-back. For example, the first sample of data for the second channel would be located at index <code>nFrames</code> (assuming the <code>buffer</code> pointer was recast to the correct data type for the stream).</p>
|
||||
<p>Certain audio APIs offer a number of parameters that influence the I/O latency of a stream. By default, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to set these parameters internally for robust (glitch-free) performance (though some APIs, like Windows Direct Sound, make this difficult). By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() function, internal stream settings will be influenced in an attempt to minimize stream latency, though possibly at the expense of stream performance.</p>
|
||||
<p>If the RTAUDIO_HOG_DEVICE flag is set, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs.</p>
|
||||
<p>If the RTAUDIO_SCHEDULE_REALTIME flag is set, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to select realtime scheduling (round-robin) for the callback thread.</p>
|
||||
<p>If the RTAUDIO_ALSA_USE_DEFAULT flag is set, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to open the "default" PCM device when using the ALSA API. Note that this will override any specified input or output device id. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a class="anchor" id="a80e306d363583da3b0a1b65d9b57c806"></a><!-- doxytag: member="RtAudio.h::RtAudioStreamStatus" ref="a80e306d363583da3b0a1b65d9b57c806" args="" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">typedef unsigned long <a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream status (over- or underflow) flags. </p>
|
||||
<p>Notification of a stream over- or underflow is indicated by a non-zero stream <code>status</code> argument in the RtAudioCallback function. The stream status can be one of the following two options, depending on whether the stream is open for output and/or input:</p>
|
||||
<ul>
|
||||
<li><em>RTAUDIO_INPUT_OVERFLOW:</em> Input data was discarded because of an overflow condition at the driver.</li>
|
||||
<li><em>RTAUDIO_OUTPUT_UNDERFLOW:</em> The output buffer ran low, likely producing a break in the output sound. </li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a class="anchor" id="a112c7b7e25a974977f6fc094cef1a31f"></a><!-- doxytag: member="RtAudio.h::RtAudioCallback" ref="a112c7b7e25a974977f6fc094cef1a31f" args=")(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, RtAudioStreamStatus status, void *userData)" -->
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">typedef int(* <a class="el" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f">RtAudioCallback</a>)(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, <a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a> status, void *userData)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="memdoc">
|
||||
|
||||
<p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> callback function prototype. </p>
|
||||
<p>All <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> clients must create a function of type RtAudioCallback to read and/or write data from/to the audio stream. When the underlying audio system is ready for new input or output data, this function will be invoked.</p>
|
||||
<dl><dt><b>Parameters:</b></dt><dd>
|
||||
<table border="0" cellspacing="2" cellpadding="0">
|
||||
<tr><td valign="top"></td><td valign="top"><em>outputBuffer</em> </td><td>For output (or duplex) streams, the client should write <code>nFrames</code> of audio sample frames into this buffer. This argument should be recast to the datatype specified when the stream was opened. For input-only streams, this argument will be NULL.</td></tr>
|
||||
<tr><td valign="top"></td><td valign="top"><em>inputBuffer</em> </td><td>For input (or duplex) streams, this buffer will hold <code>nFrames</code> of input audio sample frames. This argument should be recast to the datatype specified when the stream was opened. For output-only streams, this argument will be NULL.</td></tr>
|
||||
<tr><td valign="top"></td><td valign="top"><em>nFrames</em> </td><td>The number of sample frames of input or output data in the buffers. The actual buffer size in bytes is dependent on the data type and number of channels in use.</td></tr>
|
||||
<tr><td valign="top"></td><td valign="top"><em>streamTime</em> </td><td>The number of seconds that have elapsed since the stream was started.</td></tr>
|
||||
<tr><td valign="top"></td><td valign="top"><em>status</em> </td><td>If non-zero, this argument indicates a data overflow or underflow condition for the stream. The particular condition can be determined by comparison with the RtAudioStreamStatus flags.</td></tr>
|
||||
<tr><td valign="top"></td><td valign="top"><em>userData</em> </td><td>A pointer to optional data provided by the client when opening the stream (default = NULL).</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>To continue normal stream operation, the RtAudioCallback function should return a value of zero. To stop the stream and drain the output buffer, the function should return a value of one. To abort the stream immediately, the client should return a value of two. </p>
|
||||
|
||||
</div>
|
||||
</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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
646
doc/html/RtAudio_8h_source.html
Normal file
646
doc/html/RtAudio_8h_source.html
Normal file
@@ -0,0 +1,646 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>RtAudio.h</h1><a href="RtAudio_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/************************************************************************/</span>
|
||||
<a name="l00039"></a>00039 <span class="comment">/************************************************************************/</span>
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00045"></a>00045 <span class="comment">// RtAudio: Version 4.0.10</span>
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00047"></a>00047 <span class="preprocessor">#ifndef __RTAUDIO_H</span>
|
||||
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#define __RTAUDIO_H</span>
|
||||
<a name="l00049"></a>00049 <span class="preprocessor"></span>
|
||||
<a name="l00050"></a>00050 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00051"></a>00051 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00052"></a>00052 <span class="preprocessor">#include "RtError.h"</span>
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00072"></a><a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8">00072</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a>;
|
||||
<a name="l00073"></a>00073 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> RTAUDIO_SINT8 = 0x1; <span class="comment">// 8-bit signed integer.</span>
|
||||
<a name="l00074"></a>00074 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> RTAUDIO_SINT16 = 0x2; <span class="comment">// 16-bit signed integer.</span>
|
||||
<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> RTAUDIO_SINT24 = 0x4; <span class="comment">// Lower 3 bytes of 32-bit signed integer.</span>
|
||||
<a name="l00076"></a>00076 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> RTAUDIO_SINT32 = 0x8; <span class="comment">// 32-bit signed integer.</span>
|
||||
<a name="l00077"></a>00077 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> RTAUDIO_FLOAT32 = 0x10; <span class="comment">// Normalized between plus/minus 1.0.</span>
|
||||
<a name="l00078"></a>00078 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> RTAUDIO_FLOAT64 = 0x20; <span class="comment">// Normalized between plus/minus 1.0.</span>
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00122"></a><a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41">00122</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a>;
|
||||
<a name="l00123"></a>00123 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a> RTAUDIO_NONINTERLEAVED = 0x1; <span class="comment">// Use non-interleaved buffers (default = interleaved).</span>
|
||||
<a name="l00124"></a>00124 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a> RTAUDIO_MINIMIZE_LATENCY = 0x2; <span class="comment">// Attempt to set stream parameters for lowest possible latency.</span>
|
||||
<a name="l00125"></a>00125 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a> RTAUDIO_HOG_DEVICE = 0x4; <span class="comment">// Attempt grab device and prevent use by others.</span>
|
||||
<a name="l00126"></a>00126 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a> RTAUDIO_SCHEDULE_REALTIME = 0x8; <span class="comment">// Try to select realtime scheduling for callback thread.</span>
|
||||
<a name="l00127"></a>00127 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a> RTAUDIO_ALSA_USE_DEFAULT = 0x10; <span class="comment">// Use the "default" PCM device (ALSA only).</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00140"></a><a class="code" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">00140</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806" title="RtAudio stream status (over- or underflow) flags.">RtAudioStreamStatus</a>;
|
||||
<a name="l00141"></a>00141 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806" title="RtAudio stream status (over- or underflow) flags.">RtAudioStreamStatus</a> RTAUDIO_INPUT_OVERFLOW = 0x1; <span class="comment">// Input data was discarded because of an overflow condition at the driver.</span>
|
||||
<a name="l00142"></a>00142 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806" title="RtAudio stream status (over- or underflow) flags.">RtAudioStreamStatus</a> RTAUDIO_OUTPUT_UNDERFLOW = 0x2; <span class="comment">// The output buffer ran low, likely causing a gap in the output sound.</span>
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00183"></a><a class="code" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f">00183</a> <span class="keyword">typedef</span> int (*<a class="code" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f" title="RtAudio callback function prototype.">RtAudioCallback</a>)( <span class="keywordtype">void</span> *outputBuffer, <span class="keywordtype">void</span> *inputBuffer,
|
||||
<a name="l00184"></a>00184 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames,
|
||||
<a name="l00185"></a>00185 <span class="keywordtype">double</span> streamTime,
|
||||
<a name="l00186"></a>00186 <a class="code" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806" title="RtAudio stream status (over- or underflow) flags.">RtAudioStreamStatus</a> status,
|
||||
<a name="l00187"></a>00187 <span class="keywordtype">void</span> *userData );
|
||||
<a name="l00188"></a>00188
|
||||
<a name="l00189"></a>00189
|
||||
<a name="l00190"></a>00190 <span class="comment">// **************************************************************** //</span>
|
||||
<a name="l00191"></a>00191 <span class="comment">//</span>
|
||||
<a name="l00192"></a>00192 <span class="comment">// RtAudio class declaration.</span>
|
||||
<a name="l00193"></a>00193 <span class="comment">//</span>
|
||||
<a name="l00194"></a>00194 <span class="comment">// RtAudio is a "controller" used to select an available audio i/o</span>
|
||||
<a name="l00195"></a>00195 <span class="comment">// interface. It presents a common API for the user to call but all</span>
|
||||
<a name="l00196"></a>00196 <span class="comment">// functionality is implemented by the class RtApi and its</span>
|
||||
<a name="l00197"></a>00197 <span class="comment">// subclasses. RtAudio creates an instance of an RtApi subclass</span>
|
||||
<a name="l00198"></a>00198 <span class="comment">// based on the user's API choice. If no choice is made, RtAudio</span>
|
||||
<a name="l00199"></a>00199 <span class="comment">// attempts to make a "logical" API selection.</span>
|
||||
<a name="l00200"></a>00200 <span class="comment">//</span>
|
||||
<a name="l00201"></a>00201 <span class="comment">// **************************************************************** //</span>
|
||||
<a name="l00202"></a>00202
|
||||
<a name="l00203"></a>00203 <span class="keyword">class </span>RtApi;
|
||||
<a name="l00204"></a>00204
|
||||
<a name="l00205"></a><a class="code" href="classRtAudio.html">00205</a> <span class="keyword">class </span><a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>
|
||||
<a name="l00206"></a>00206 {
|
||||
<a name="l00207"></a>00207 <span class="keyword">public</span>:
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00210"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849">00210</a> <span class="keyword">enum</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">Api</a> {
|
||||
<a name="l00211"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849aa49af3ac767106158bc6cad74fb214ae">00211</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849aa49af3ac767106158bc6cad74fb214ae">UNSPECIFIED</a>,
|
||||
<a name="l00212"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849aa7a2ba095c2806caa893b6fb8fc3a1a8">00212</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849aa7a2ba095c2806caa893b6fb8fc3a1a8">LINUX_ALSA</a>,
|
||||
<a name="l00213"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a39c84615e61de75e6a4e865596d62c82">00213</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a39c84615e61de75e6a4e865596d62c82">LINUX_OSS</a>,
|
||||
<a name="l00214"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a4767e17c6edfbd827f91763915df4105">00214</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a4767e17c6edfbd827f91763915df4105">UNIX_JACK</a>,
|
||||
<a name="l00215"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a9fec92b8272244a87a6a11a717bd662d">00215</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a9fec92b8272244a87a6a11a717bd662d">MACOSX_CORE</a>,
|
||||
<a name="l00216"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a219517d1df90f94d07758481155bd469">00216</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a219517d1df90f94d07758481155bd469">WINDOWS_ASIO</a>,
|
||||
<a name="l00217"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a28478830f42c2fd61e6c7ad498901931">00217</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a28478830f42c2fd61e6c7ad498901931">WINDOWS_DS</a>,
|
||||
<a name="l00218"></a><a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849ab06b8fd88bf18c9a2b8271f6961ae2d1">00218</a> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849ab06b8fd88bf18c9a2b8271f6961ae2d1">RTAUDIO_DUMMY</a>
|
||||
<a name="l00219"></a>00219 };
|
||||
<a name="l00220"></a>00220
|
||||
<a name="l00222"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html">00222</a> <span class="keyword">struct </span><a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">DeviceInfo</a> {
|
||||
<a name="l00223"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a97573717ccb1e75a834a0a108cd6982d">00223</a> <span class="keywordtype">bool</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a97573717ccb1e75a834a0a108cd6982d">probed</a>;
|
||||
<a name="l00224"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a24df596ab8d54f2eb540c7cf16212b3b">00224</a> std::string <a class="code" href="structRtAudio_1_1DeviceInfo.html#a24df596ab8d54f2eb540c7cf16212b3b">name</a>;
|
||||
<a name="l00225"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a81aaf488f8158ef55b1bb678f66feb7d">00225</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a81aaf488f8158ef55b1bb678f66feb7d">outputChannels</a>;
|
||||
<a name="l00226"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a56247b458a937ae84d98ca9c4b243275">00226</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a56247b458a937ae84d98ca9c4b243275">inputChannels</a>;
|
||||
<a name="l00227"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a3e8ad34c2d14e24293a0beafc26186e7">00227</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a3e8ad34c2d14e24293a0beafc26186e7">duplexChannels</a>;
|
||||
<a name="l00228"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a5365245e73ffe29a05734de4474acd58">00228</a> <span class="keywordtype">bool</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a5365245e73ffe29a05734de4474acd58">isDefaultOutput</a>;
|
||||
<a name="l00229"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a7c8aca084bd908799b6be5954b80def2">00229</a> <span class="keywordtype">bool</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a7c8aca084bd908799b6be5954b80def2">isDefaultInput</a>;
|
||||
<a name="l00230"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#afa65f5f92f66ce7aacd3ff35e11b230f">00230</a> std::vector<unsigned int> <a class="code" href="structRtAudio_1_1DeviceInfo.html#afa65f5f92f66ce7aacd3ff35e11b230f">sampleRates</a>;
|
||||
<a name="l00231"></a><a class="code" href="structRtAudio_1_1DeviceInfo.html#a23251b549b89b2fe04a57fcd7cb76ea4">00231</a> <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> <a class="code" href="structRtAudio_1_1DeviceInfo.html#a23251b549b89b2fe04a57fcd7cb76ea4">nativeFormats</a>;
|
||||
<a name="l00233"></a>00233 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00234"></a>00234 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">DeviceInfo</a>()
|
||||
<a name="l00235"></a>00235 :<a class="code" href="structRtAudio_1_1DeviceInfo.html#a97573717ccb1e75a834a0a108cd6982d">probed</a>(false), <a class="code" href="structRtAudio_1_1DeviceInfo.html#a81aaf488f8158ef55b1bb678f66feb7d">outputChannels</a>(0), <a class="code" href="structRtAudio_1_1DeviceInfo.html#a56247b458a937ae84d98ca9c4b243275">inputChannels</a>(0), <a class="code" href="structRtAudio_1_1DeviceInfo.html#a3e8ad34c2d14e24293a0beafc26186e7">duplexChannels</a>(0),
|
||||
<a name="l00236"></a>00236 <a class="code" href="structRtAudio_1_1DeviceInfo.html#a5365245e73ffe29a05734de4474acd58">isDefaultOutput</a>(false), <a class="code" href="structRtAudio_1_1DeviceInfo.html#a7c8aca084bd908799b6be5954b80def2">isDefaultInput</a>(false), <a class="code" href="structRtAudio_1_1DeviceInfo.html#a23251b549b89b2fe04a57fcd7cb76ea4">nativeFormats</a>(0) {}
|
||||
<a name="l00237"></a>00237 };
|
||||
<a name="l00238"></a>00238
|
||||
<a name="l00240"></a><a class="code" href="structRtAudio_1_1StreamParameters.html">00240</a> <span class="keyword">struct </span><a class="code" href="structRtAudio_1_1StreamParameters.html" title="The structure for specifying input or ouput stream parameters.">StreamParameters</a> {
|
||||
<a name="l00241"></a><a class="code" href="structRtAudio_1_1StreamParameters.html#ab3c72bcf3ef12149ae9a4fb597cc5489">00241</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1StreamParameters.html#ab3c72bcf3ef12149ae9a4fb597cc5489">deviceId</a>;
|
||||
<a name="l00242"></a><a class="code" href="structRtAudio_1_1StreamParameters.html#a88a10091b6e284e21235cc6f25332ebd">00242</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1StreamParameters.html#a88a10091b6e284e21235cc6f25332ebd">nChannels</a>;
|
||||
<a name="l00243"></a><a class="code" href="structRtAudio_1_1StreamParameters.html#ad4b4503782653ec93c83328c46abe50c">00243</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1StreamParameters.html#ad4b4503782653ec93c83328c46abe50c">firstChannel</a>;
|
||||
<a name="l00245"></a>00245 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00246"></a>00246 <a class="code" href="structRtAudio_1_1StreamParameters.html" title="The structure for specifying input or ouput stream parameters.">StreamParameters</a>()
|
||||
<a name="l00247"></a>00247 : <a class="code" href="structRtAudio_1_1StreamParameters.html#ab3c72bcf3ef12149ae9a4fb597cc5489">deviceId</a>(0), <a class="code" href="structRtAudio_1_1StreamParameters.html#a88a10091b6e284e21235cc6f25332ebd">nChannels</a>(0), <a class="code" href="structRtAudio_1_1StreamParameters.html#ad4b4503782653ec93c83328c46abe50c">firstChannel</a>(0) {}
|
||||
<a name="l00248"></a>00248 };
|
||||
<a name="l00249"></a>00249
|
||||
<a name="l00251"></a>00251
|
||||
<a name="l00307"></a><a class="code" href="structRtAudio_1_1StreamOptions.html">00307</a> <span class="keyword">struct </span><a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">StreamOptions</a> {
|
||||
<a name="l00308"></a><a class="code" href="structRtAudio_1_1StreamOptions.html#a0ecc98b031aa3af49d09b781643e298b">00308</a> <a class="code" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41" title="RtAudio stream option flags.">RtAudioStreamFlags</a> <a class="code" href="structRtAudio_1_1StreamOptions.html#a0ecc98b031aa3af49d09b781643e298b">flags</a>;
|
||||
<a name="l00309"></a><a class="code" href="structRtAudio_1_1StreamOptions.html#a75a14cfab903d0e1c091bc16aec80240">00309</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1StreamOptions.html#a75a14cfab903d0e1c091bc16aec80240">numberOfBuffers</a>;
|
||||
<a name="l00310"></a><a class="code" href="structRtAudio_1_1StreamOptions.html#a2a4b0b8d690c624d20f4e8f4be6ca9ba">00310</a> std::string <a class="code" href="structRtAudio_1_1StreamOptions.html#a2a4b0b8d690c624d20f4e8f4be6ca9ba">streamName</a>;
|
||||
<a name="l00311"></a><a class="code" href="structRtAudio_1_1StreamOptions.html#adfd267059434edb21573c584e6367def">00311</a> <span class="keywordtype">int</span> <a class="code" href="structRtAudio_1_1StreamOptions.html#adfd267059434edb21573c584e6367def">priority</a>;
|
||||
<a name="l00313"></a>00313 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00314"></a>00314 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">StreamOptions</a>()
|
||||
<a name="l00315"></a>00315 : <a class="code" href="structRtAudio_1_1StreamOptions.html#a0ecc98b031aa3af49d09b781643e298b">flags</a>(0), <a class="code" href="structRtAudio_1_1StreamOptions.html#a75a14cfab903d0e1c091bc16aec80240">numberOfBuffers</a>(0), <a class="code" href="structRtAudio_1_1StreamOptions.html#adfd267059434edb21573c584e6367def">priority</a>(0) {}
|
||||
<a name="l00316"></a>00316 };
|
||||
<a name="l00317"></a>00317
|
||||
<a name="l00319"></a>00319
|
||||
<a name="l00324"></a>00324 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#ae266ffad2ef428d0b2c6c262d391ce26" title="A static function to determine the available compiled audio APIs.">getCompiledApi</a>( std::vector<RtAudio::Api> &apis ) <span class="keywordflow">throw</span>();
|
||||
<a name="l00325"></a>00325
|
||||
<a name="l00327"></a>00327
|
||||
<a name="l00335"></a>00335 <a class="code" href="classRtAudio.html#afd0bfa26deae9804e18faff59d0273d9" title="The class constructor.">RtAudio</a>( <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> api=<a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849aa49af3ac767106158bc6cad74fb214ae">UNSPECIFIED</a> ) throw();
|
||||
<a name="l00336"></a>00336
|
||||
<a name="l00338"></a>00338
|
||||
<a name="l00342"></a>00342 ~<a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>() throw();
|
||||
<a name="l00343"></a>00343
|
||||
<a name="l00345"></a>00345 <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>::<a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">Api</a> <a class="code" href="classRtAudio.html#a83687634795792b2c47e4ae1cf8a5246" title="Returns the audio API specifier for the current instance of RtAudio.">getCurrentApi</a>( <span class="keywordtype">void</span> ) throw();
|
||||
<a name="l00346"></a>00346
|
||||
<a name="l00348"></a>00348
|
||||
<a name="l00353"></a>00353 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a747ce2d73803641bbb66d6e78092aa1a" title="A public function that queries for the number of audio devices available.">getDeviceCount</a>( <span class="keywordtype">void</span> ) throw();
|
||||
<a name="l00354"></a>00354
|
||||
<a name="l00356"></a>00356
|
||||
<a name="l00366"></a>00366 <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>::DeviceInfo <a class="code" href="classRtAudio.html#a02d7ff44ad1d7eae22283a052f3dfda8" title="Return an RtAudio::DeviceInfo structure for a specified device number.">getDeviceInfo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00367"></a>00367
|
||||
<a name="l00369"></a>00369
|
||||
<a name="l00376"></a>00376 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a3a3f3dbe13ea696b521e49cdaaa357bc" title="A function that returns the index of the default output device.">getDefaultOutputDevice</a>( <span class="keywordtype">void</span> ) throw();
|
||||
<a name="l00377"></a>00377
|
||||
<a name="l00379"></a>00379
|
||||
<a name="l00386"></a>00386 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#aad8b94edd3cd379ee300b125750ac6ce" title="A function that returns the index of the default input device.">getDefaultInputDevice</a>( <span class="keywordtype">void</span> ) throw();
|
||||
<a name="l00387"></a>00387
|
||||
<a name="l00389"></a>00389
|
||||
<a name="l00426"></a>00426 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#afacc99740fa4c5606fb35467cdea6da8" title="A public function for opening a stream with the specified parameters.">openStream</a>( <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>::StreamParameters *outputParameters,
|
||||
<a name="l00427"></a>00427 <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>::StreamParameters *inputParameters,
|
||||
<a name="l00428"></a>00428 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00429"></a>00429 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferFrames, <a class="code" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f" title="RtAudio callback function prototype.">RtAudioCallback</a> callback,
|
||||
<a name="l00430"></a>00430 <span class="keywordtype">void</span> *userData = NULL, <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>::StreamOptions *options = NULL );
|
||||
<a name="l00431"></a>00431
|
||||
<a name="l00433"></a>00433
|
||||
<a name="l00437"></a>00437 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#a90d599002ad32cf250a4cb866f2cc93a" title="A function that closes a stream and frees any associated stream memory.">closeStream</a>( <span class="keywordtype">void</span> ) throw();
|
||||
<a name="l00438"></a>00438
|
||||
<a name="l00440"></a>00440
|
||||
<a name="l00446"></a>00446 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#aec017a89629ccef66a90b60be22a2f80" title="A function that starts a stream.">startStream</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00447"></a>00447
|
||||
<a name="l00449"></a>00449
|
||||
<a name="l00455"></a>00455 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#af4c241ff86936ecc8108f0d9dfe3efdd" title="Stop a stream, allowing any samples remaining in the output queue to be played.">stopStream</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00456"></a>00456
|
||||
<a name="l00458"></a>00458
|
||||
<a name="l00464"></a>00464 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#ad0586b47cd6bb9591a80b4052815991f" title="Stop a stream, discarding any samples remaining in the input/output queue.">abortStream</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00465"></a>00465
|
||||
<a name="l00467"></a>00467 <span class="keywordtype">bool</span> <a class="code" href="classRtAudio.html#a3863e45ff81dbe97176de0ee7545917f" title="Returns true if a stream is open and false if not.">isStreamOpen</a>( <span class="keywordtype">void</span> ) const throw();
|
||||
<a name="l00468"></a>00468
|
||||
<a name="l00470"></a>00470 <span class="keywordtype">bool</span> <a class="code" href="classRtAudio.html#a84cc8d9b7ab9bc5f37bcf48430ec5aea" title="Returns true if the stream is running and false if it is stopped or not open.">isStreamRunning</a>( <span class="keywordtype">void</span> ) const throw();
|
||||
<a name="l00471"></a>00471
|
||||
<a name="l00473"></a>00473
|
||||
<a name="l00476"></a>00476 <span class="keywordtype">double</span> <a class="code" href="classRtAudio.html#a344e59a62353c5791db4621b985cb2ca" title="Returns the number of elapsed seconds since the stream was started.">getStreamTime</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00477"></a>00477
|
||||
<a name="l00479"></a>00479
|
||||
<a name="l00487"></a>00487 <span class="keywordtype">long</span> <a class="code" href="classRtAudio.html#a843c989d9f501c71bc2f2c5ca18df9f3" title="Returns the internal stream latency in sample frames.">getStreamLatency</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00488"></a>00488
|
||||
<a name="l00490"></a>00490
|
||||
<a name="l00495"></a>00495 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a28214b8b05d60b45c24ee6fae7b2a0b5" title="Returns actual sample rate in use by the stream.">getStreamSampleRate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00496"></a>00496
|
||||
<a name="l00498"></a>00498 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#af0752ee51cce3dd90a3bd009f9fdbe77" title="Specify whether warning messages should be printed to stderr.">showWarnings</a>( <span class="keywordtype">bool</span> value = true ) throw();
|
||||
<a name="l00499"></a>00499
|
||||
<a name="l00500"></a>00500 protected:
|
||||
<a name="l00501"></a>00501
|
||||
<a name="l00502"></a>00502 <span class="keywordtype">void</span> openRtApi( <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>::<a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">Api</a> api );
|
||||
<a name="l00503"></a>00503 RtApi *rtapi_;
|
||||
<a name="l00504"></a>00504 };
|
||||
<a name="l00505"></a>00505
|
||||
<a name="l00506"></a>00506 <span class="comment">// Operating system dependent thread functionality.</span>
|
||||
<a name="l00507"></a>00507 <span class="preprocessor">#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__)</span>
|
||||
<a name="l00508"></a>00508 <span class="preprocessor"></span><span class="preprocessor"> #include <windows.h></span>
|
||||
<a name="l00509"></a>00509 <span class="preprocessor"> #include <process.h></span>
|
||||
<a name="l00510"></a>00510
|
||||
<a name="l00511"></a>00511 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> ThreadHandle;
|
||||
<a name="l00512"></a>00512 <span class="keyword">typedef</span> CRITICAL_SECTION StreamMutex;
|
||||
<a name="l00513"></a>00513
|
||||
<a name="l00514"></a>00514 <span class="preprocessor">#elif defined(__LINUX_ALSA__) || defined(__UNIX_JACK__) || defined(__LINUX_OSS__) || defined(__MACOSX_CORE__)</span>
|
||||
<a name="l00515"></a>00515 <span class="preprocessor"></span> <span class="comment">// Using pthread library for various flavors of unix.</span>
|
||||
<a name="l00516"></a>00516 <span class="preprocessor"> #include <pthread.h></span>
|
||||
<a name="l00517"></a>00517
|
||||
<a name="l00518"></a>00518 <span class="keyword">typedef</span> pthread_t ThreadHandle;
|
||||
<a name="l00519"></a>00519 <span class="keyword">typedef</span> pthread_mutex_t StreamMutex;
|
||||
<a name="l00520"></a>00520
|
||||
<a name="l00521"></a>00521 <span class="preprocessor">#else // Setup for "dummy" behavior</span>
|
||||
<a name="l00522"></a>00522 <span class="preprocessor"></span>
|
||||
<a name="l00523"></a>00523 <span class="preprocessor"> #define __RTAUDIO_DUMMY__</span>
|
||||
<a name="l00524"></a>00524 <span class="preprocessor"></span> <span class="keyword">typedef</span> <span class="keywordtype">int</span> ThreadHandle;
|
||||
<a name="l00525"></a>00525 <span class="keyword">typedef</span> <span class="keywordtype">int</span> StreamMutex;
|
||||
<a name="l00526"></a>00526
|
||||
<a name="l00527"></a>00527 <span class="preprocessor">#endif</span>
|
||||
<a name="l00528"></a>00528 <span class="preprocessor"></span>
|
||||
<a name="l00529"></a>00529 <span class="comment">// This global structure type is used to pass callback information</span>
|
||||
<a name="l00530"></a>00530 <span class="comment">// between the private RtAudio stream structure and global callback</span>
|
||||
<a name="l00531"></a>00531 <span class="comment">// handling functions.</span>
|
||||
<a name="l00532"></a>00532 <span class="keyword">struct </span>CallbackInfo {
|
||||
<a name="l00533"></a>00533 <span class="keywordtype">void</span> *object; <span class="comment">// Used as a "this" pointer.</span>
|
||||
<a name="l00534"></a>00534 ThreadHandle thread;
|
||||
<a name="l00535"></a>00535 <span class="keywordtype">void</span> *callback;
|
||||
<a name="l00536"></a>00536 <span class="keywordtype">void</span> *userData;
|
||||
<a name="l00537"></a>00537 <span class="keywordtype">void</span> *apiInfo; <span class="comment">// void pointer for API specific callback information</span>
|
||||
<a name="l00538"></a>00538 <span class="keywordtype">bool</span> isRunning;
|
||||
<a name="l00539"></a>00539
|
||||
<a name="l00540"></a>00540 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00541"></a>00541 CallbackInfo()
|
||||
<a name="l00542"></a>00542 :object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {}
|
||||
<a name="l00543"></a>00543 };
|
||||
<a name="l00544"></a>00544
|
||||
<a name="l00545"></a>00545 <span class="comment">// **************************************************************** //</span>
|
||||
<a name="l00546"></a>00546 <span class="comment">//</span>
|
||||
<a name="l00547"></a>00547 <span class="comment">// RtApi class declaration.</span>
|
||||
<a name="l00548"></a>00548 <span class="comment">//</span>
|
||||
<a name="l00549"></a>00549 <span class="comment">// Subclasses of RtApi contain all API- and OS-specific code necessary</span>
|
||||
<a name="l00550"></a>00550 <span class="comment">// to fully implement the RtAudio API.</span>
|
||||
<a name="l00551"></a>00551 <span class="comment">//</span>
|
||||
<a name="l00552"></a>00552 <span class="comment">// Note that RtApi is an abstract base class and cannot be</span>
|
||||
<a name="l00553"></a>00553 <span class="comment">// explicitly instantiated. The class RtAudio will create an</span>
|
||||
<a name="l00554"></a>00554 <span class="comment">// instance of an RtApi subclass (RtApiOss, RtApiAlsa,</span>
|
||||
<a name="l00555"></a>00555 <span class="comment">// RtApiJack, RtApiCore, RtApiAl, RtApiDs, or RtApiAsio).</span>
|
||||
<a name="l00556"></a>00556 <span class="comment">//</span>
|
||||
<a name="l00557"></a>00557 <span class="comment">// **************************************************************** //</span>
|
||||
<a name="l00558"></a>00558
|
||||
<a name="l00559"></a>00559 <span class="preprocessor">#if defined( HAVE_GETTIMEOFDAY )</span>
|
||||
<a name="l00560"></a>00560 <span class="preprocessor"></span><span class="preprocessor"> #include <sys/time.h></span>
|
||||
<a name="l00561"></a>00561 <span class="preprocessor">#endif</span>
|
||||
<a name="l00562"></a>00562 <span class="preprocessor"></span>
|
||||
<a name="l00563"></a>00563 <span class="preprocessor">#include <sstream></span>
|
||||
<a name="l00564"></a>00564
|
||||
<a name="l00565"></a>00565 <span class="keyword">class </span>RtApi
|
||||
<a name="l00566"></a>00566 {
|
||||
<a name="l00567"></a>00567 <span class="keyword">public</span>:
|
||||
<a name="l00568"></a>00568
|
||||
<a name="l00569"></a>00569 RtApi();
|
||||
<a name="l00570"></a>00570 <span class="keyword">virtual</span> ~RtApi();
|
||||
<a name="l00571"></a>00571 <span class="keyword">virtual</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> <a class="code" href="classRtAudio.html#a83687634795792b2c47e4ae1cf8a5246" title="Returns the audio API specifier for the current instance of RtAudio.">getCurrentApi</a>( <span class="keywordtype">void</span> ) = 0;
|
||||
<a name="l00572"></a>00572 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a747ce2d73803641bbb66d6e78092aa1a" title="A public function that queries for the number of audio devices available.">getDeviceCount</a>( <span class="keywordtype">void</span> ) = 0;
|
||||
<a name="l00573"></a>00573 <span class="keyword">virtual</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> <a class="code" href="classRtAudio.html#a02d7ff44ad1d7eae22283a052f3dfda8" title="Return an RtAudio::DeviceInfo structure for a specified device number.">getDeviceInfo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device ) = 0;
|
||||
<a name="l00574"></a>00574 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#aad8b94edd3cd379ee300b125750ac6ce" title="A function that returns the index of the default input device.">getDefaultInputDevice</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00575"></a>00575 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a3a3f3dbe13ea696b521e49cdaaa357bc" title="A function that returns the index of the default output device.">getDefaultOutputDevice</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00576"></a>00576 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#afacc99740fa4c5606fb35467cdea6da8" title="A public function for opening a stream with the specified parameters.">openStream</a>( <a class="code" href="structRtAudio_1_1StreamParameters.html" title="The structure for specifying input or ouput stream parameters.">RtAudio::StreamParameters</a> *outputParameters,
|
||||
<a name="l00577"></a>00577 <a class="code" href="structRtAudio_1_1StreamParameters.html" title="The structure for specifying input or ouput stream parameters.">RtAudio::StreamParameters</a> *inputParameters,
|
||||
<a name="l00578"></a>00578 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00579"></a>00579 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferFrames, <a class="code" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f" title="RtAudio callback function prototype.">RtAudioCallback</a> callback,
|
||||
<a name="l00580"></a>00580 <span class="keywordtype">void</span> *userData, <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00581"></a>00581 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#a90d599002ad32cf250a4cb866f2cc93a" title="A function that closes a stream and frees any associated stream memory.">closeStream</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00582"></a>00582 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#aec017a89629ccef66a90b60be22a2f80" title="A function that starts a stream.">startStream</a>( <span class="keywordtype">void</span> ) = 0;
|
||||
<a name="l00583"></a>00583 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#af4c241ff86936ecc8108f0d9dfe3efdd" title="Stop a stream, allowing any samples remaining in the output queue to be played.">stopStream</a>( <span class="keywordtype">void</span> ) = 0;
|
||||
<a name="l00584"></a>00584 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#ad0586b47cd6bb9591a80b4052815991f" title="Stop a stream, discarding any samples remaining in the input/output queue.">abortStream</a>( <span class="keywordtype">void</span> ) = 0;
|
||||
<a name="l00585"></a>00585 <span class="keywordtype">long</span> <a class="code" href="classRtAudio.html#a843c989d9f501c71bc2f2c5ca18df9f3" title="Returns the internal stream latency in sample frames.">getStreamLatency</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00586"></a>00586 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a28214b8b05d60b45c24ee6fae7b2a0b5" title="Returns actual sample rate in use by the stream.">getStreamSampleRate</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00587"></a>00587 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classRtAudio.html#a344e59a62353c5791db4621b985cb2ca" title="Returns the number of elapsed seconds since the stream was started.">getStreamTime</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00588"></a>00588 <span class="keywordtype">bool</span> <a class="code" href="classRtAudio.html#a3863e45ff81dbe97176de0ee7545917f" title="Returns true if a stream is open and false if not.">isStreamOpen</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> stream_.state != STREAM_CLOSED; };
|
||||
<a name="l00589"></a>00589 <span class="keywordtype">bool</span> <a class="code" href="classRtAudio.html#a84cc8d9b7ab9bc5f37bcf48430ec5aea" title="Returns true if the stream is running and false if it is stopped or not open.">isStreamRunning</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> stream_.state == STREAM_RUNNING; };
|
||||
<a name="l00590"></a>00590 <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#af0752ee51cce3dd90a3bd009f9fdbe77" title="Specify whether warning messages should be printed to stderr.">showWarnings</a>( <span class="keywordtype">bool</span> value ) { showWarnings_ = value; };
|
||||
<a name="l00591"></a>00591
|
||||
<a name="l00592"></a>00592
|
||||
<a name="l00593"></a>00593 <span class="keyword">protected</span>:
|
||||
<a name="l00594"></a>00594
|
||||
<a name="l00595"></a>00595 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> MAX_SAMPLE_RATES;
|
||||
<a name="l00596"></a>00596 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SAMPLE_RATES[];
|
||||
<a name="l00597"></a>00597
|
||||
<a name="l00598"></a>00598 <span class="keyword">enum</span> { FAILURE, SUCCESS };
|
||||
<a name="l00599"></a>00599
|
||||
<a name="l00600"></a>00600 <span class="keyword">enum</span> StreamState {
|
||||
<a name="l00601"></a>00601 STREAM_STOPPED,
|
||||
<a name="l00602"></a>00602 STREAM_RUNNING,
|
||||
<a name="l00603"></a>00603 STREAM_CLOSED = -50
|
||||
<a name="l00604"></a>00604 };
|
||||
<a name="l00605"></a>00605
|
||||
<a name="l00606"></a>00606 <span class="keyword">enum</span> StreamMode {
|
||||
<a name="l00607"></a>00607 OUTPUT,
|
||||
<a name="l00608"></a>00608 INPUT,
|
||||
<a name="l00609"></a>00609 DUPLEX,
|
||||
<a name="l00610"></a>00610 UNINITIALIZED = -75
|
||||
<a name="l00611"></a>00611 };
|
||||
<a name="l00612"></a>00612
|
||||
<a name="l00613"></a>00613 <span class="comment">// A protected structure used for buffer conversion.</span>
|
||||
<a name="l00614"></a>00614 <span class="keyword">struct </span>ConvertInfo {
|
||||
<a name="l00615"></a>00615 <span class="keywordtype">int</span> channels;
|
||||
<a name="l00616"></a>00616 <span class="keywordtype">int</span> inJump, outJump;
|
||||
<a name="l00617"></a>00617 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> inFormat, outFormat;
|
||||
<a name="l00618"></a>00618 std::vector<int> inOffset;
|
||||
<a name="l00619"></a>00619 std::vector<int> outOffset;
|
||||
<a name="l00620"></a>00620 };
|
||||
<a name="l00621"></a>00621
|
||||
<a name="l00622"></a>00622 <span class="comment">// A protected structure for audio streams.</span>
|
||||
<a name="l00623"></a>00623 <span class="keyword">struct </span>RtApiStream {
|
||||
<a name="l00624"></a>00624 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00625"></a>00625 <span class="keywordtype">void</span> *apiHandle; <span class="comment">// void pointer for API specific stream handle information</span>
|
||||
<a name="l00626"></a>00626 StreamMode mode; <span class="comment">// OUTPUT, INPUT, or DUPLEX.</span>
|
||||
<a name="l00627"></a>00627 StreamState state; <span class="comment">// STOPPED, RUNNING, or CLOSED</span>
|
||||
<a name="l00628"></a>00628 <span class="keywordtype">char</span> *userBuffer[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00629"></a>00629 <span class="keywordtype">char</span> *deviceBuffer;
|
||||
<a name="l00630"></a>00630 <span class="keywordtype">bool</span> doConvertBuffer[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00631"></a>00631 <span class="keywordtype">bool</span> userInterleaved;
|
||||
<a name="l00632"></a>00632 <span class="keywordtype">bool</span> deviceInterleaved[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00633"></a>00633 <span class="keywordtype">bool</span> doByteSwap[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00634"></a>00634 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate;
|
||||
<a name="l00635"></a>00635 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bufferSize;
|
||||
<a name="l00636"></a>00636 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nBuffers;
|
||||
<a name="l00637"></a>00637 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nUserChannels[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00638"></a>00638 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nDeviceChannels[2]; <span class="comment">// Playback and record channels, respectively.</span>
|
||||
<a name="l00639"></a>00639 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelOffset[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00640"></a>00640 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> latency[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00641"></a>00641 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> userFormat;
|
||||
<a name="l00642"></a>00642 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> deviceFormat[2]; <span class="comment">// Playback and record, respectively.</span>
|
||||
<a name="l00643"></a>00643 StreamMutex mutex;
|
||||
<a name="l00644"></a>00644 CallbackInfo callbackInfo;
|
||||
<a name="l00645"></a>00645 ConvertInfo convertInfo[2];
|
||||
<a name="l00646"></a>00646 <span class="keywordtype">double</span> streamTime; <span class="comment">// Number of elapsed seconds since the stream started.</span>
|
||||
<a name="l00647"></a>00647
|
||||
<a name="l00648"></a>00648 <span class="preprocessor">#if defined(HAVE_GETTIMEOFDAY)</span>
|
||||
<a name="l00649"></a>00649 <span class="preprocessor"></span> <span class="keyword">struct </span>timeval lastTickTimestamp;
|
||||
<a name="l00650"></a>00650 <span class="preprocessor">#endif</span>
|
||||
<a name="l00651"></a>00651 <span class="preprocessor"></span>
|
||||
<a name="l00652"></a>00652 RtApiStream()
|
||||
<a name="l00653"></a>00653 :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
|
||||
<a name="l00654"></a>00654 };
|
||||
<a name="l00655"></a>00655
|
||||
<a name="l00656"></a>00656 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">short</span> Int16;
|
||||
<a name="l00657"></a>00657 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">int</span> Int32;
|
||||
<a name="l00658"></a>00658 <span class="keyword">typedef</span> <span class="keywordtype">float</span> Float32;
|
||||
<a name="l00659"></a>00659 <span class="keyword">typedef</span> <span class="keywordtype">double</span> Float64;
|
||||
<a name="l00660"></a>00660
|
||||
<a name="l00661"></a>00661 std::ostringstream errorStream_;
|
||||
<a name="l00662"></a>00662 std::string errorText_;
|
||||
<a name="l00663"></a>00663 <span class="keywordtype">bool</span> showWarnings_;
|
||||
<a name="l00664"></a>00664 RtApiStream stream_;
|
||||
<a name="l00665"></a>00665
|
||||
<a name="l00673"></a>00673 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00674"></a>00674 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00675"></a>00675 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00676"></a>00676 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00677"></a>00677
|
||||
<a name="l00679"></a>00679 <span class="keywordtype">void</span> tickStreamTime( <span class="keywordtype">void</span> );
|
||||
<a name="l00680"></a>00680
|
||||
<a name="l00682"></a>00682 <span class="keywordtype">void</span> clearStreamInfo();
|
||||
<a name="l00683"></a>00683
|
||||
<a name="l00688"></a>00688 <span class="keywordtype">void</span> verifyStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00689"></a>00689
|
||||
<a name="l00691"></a>00691 <span class="keywordtype">void</span> error( <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">RtError::Type</a> type );
|
||||
<a name="l00692"></a>00692
|
||||
<a name="l00697"></a>00697 <span class="keywordtype">void</span> convertBuffer( <span class="keywordtype">char</span> *outBuffer, <span class="keywordtype">char</span> *inBuffer, ConvertInfo &info );
|
||||
<a name="l00698"></a>00698
|
||||
<a name="l00700"></a>00700 <span class="keywordtype">void</span> byteSwapBuffer( <span class="keywordtype">char</span> *buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> samples, <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format );
|
||||
<a name="l00701"></a>00701
|
||||
<a name="l00703"></a>00703 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> formatBytes( <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format );
|
||||
<a name="l00704"></a>00704
|
||||
<a name="l00706"></a>00706 <span class="keywordtype">void</span> setConvertInfo( StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel );
|
||||
<a name="l00707"></a>00707 };
|
||||
<a name="l00708"></a>00708
|
||||
<a name="l00709"></a>00709 <span class="comment">// **************************************************************** //</span>
|
||||
<a name="l00710"></a>00710 <span class="comment">//</span>
|
||||
<a name="l00711"></a>00711 <span class="comment">// Inline RtAudio definitions.</span>
|
||||
<a name="l00712"></a>00712 <span class="comment">//</span>
|
||||
<a name="l00713"></a>00713 <span class="comment">// **************************************************************** //</span>
|
||||
<a name="l00714"></a>00714
|
||||
<a name="l00715"></a><a class="code" href="classRtAudio.html#a83687634795792b2c47e4ae1cf8a5246">00715</a> <span class="keyword">inline</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> <a class="code" href="classRtAudio.html#a83687634795792b2c47e4ae1cf8a5246" title="Returns the audio API specifier for the current instance of RtAudio.">RtAudio :: getCurrentApi</a>( <span class="keywordtype">void</span> ) throw() { <span class="keywordflow">return</span> rtapi_->getCurrentApi(); }
|
||||
<a name="l00716"></a><a class="code" href="classRtAudio.html#a747ce2d73803641bbb66d6e78092aa1a">00716</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a747ce2d73803641bbb66d6e78092aa1a" title="A public function that queries for the number of audio devices available.">RtAudio :: getDeviceCount</a>( <span class="keywordtype">void</span> ) throw() { <span class="keywordflow">return</span> rtapi_->getDeviceCount(); }
|
||||
<a name="l00717"></a><a class="code" href="classRtAudio.html#a02d7ff44ad1d7eae22283a052f3dfda8">00717</a> <span class="keyword">inline</span> <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> <a class="code" href="classRtAudio.html#a02d7ff44ad1d7eae22283a052f3dfda8" title="Return an RtAudio::DeviceInfo structure for a specified device number.">RtAudio :: getDeviceInfo</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device ) { <span class="keywordflow">return</span> rtapi_->getDeviceInfo( device ); }
|
||||
<a name="l00718"></a><a class="code" href="classRtAudio.html#aad8b94edd3cd379ee300b125750ac6ce">00718</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#aad8b94edd3cd379ee300b125750ac6ce" title="A function that returns the index of the default input device.">RtAudio :: getDefaultInputDevice</a>( <span class="keywordtype">void</span> ) throw() { <span class="keywordflow">return</span> rtapi_->getDefaultInputDevice(); }
|
||||
<a name="l00719"></a><a class="code" href="classRtAudio.html#a3a3f3dbe13ea696b521e49cdaaa357bc">00719</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a3a3f3dbe13ea696b521e49cdaaa357bc" title="A function that returns the index of the default output device.">RtAudio :: getDefaultOutputDevice</a>( <span class="keywordtype">void</span> ) throw() { <span class="keywordflow">return</span> rtapi_->getDefaultOutputDevice(); }
|
||||
<a name="l00720"></a><a class="code" href="classRtAudio.html#a90d599002ad32cf250a4cb866f2cc93a">00720</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#a90d599002ad32cf250a4cb866f2cc93a" title="A function that closes a stream and frees any associated stream memory.">RtAudio :: closeStream</a>( <span class="keywordtype">void</span> ) throw() { <span class="keywordflow">return</span> rtapi_->closeStream(); }
|
||||
<a name="l00721"></a><a class="code" href="classRtAudio.html#aec017a89629ccef66a90b60be22a2f80">00721</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#aec017a89629ccef66a90b60be22a2f80" title="A function that starts a stream.">RtAudio :: startStream</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> rtapi_->startStream(); }
|
||||
<a name="l00722"></a><a class="code" href="classRtAudio.html#af4c241ff86936ecc8108f0d9dfe3efdd">00722</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#af4c241ff86936ecc8108f0d9dfe3efdd" title="Stop a stream, allowing any samples remaining in the output queue to be played.">RtAudio :: stopStream</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> rtapi_->stopStream(); }
|
||||
<a name="l00723"></a><a class="code" href="classRtAudio.html#ad0586b47cd6bb9591a80b4052815991f">00723</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#ad0586b47cd6bb9591a80b4052815991f" title="Stop a stream, discarding any samples remaining in the input/output queue.">RtAudio :: abortStream</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> rtapi_->abortStream(); }
|
||||
<a name="l00724"></a><a class="code" href="classRtAudio.html#a3863e45ff81dbe97176de0ee7545917f">00724</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classRtAudio.html#a3863e45ff81dbe97176de0ee7545917f" title="Returns true if a stream is open and false if not.">RtAudio :: isStreamOpen</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> rtapi_->isStreamOpen(); }
|
||||
<a name="l00725"></a><a class="code" href="classRtAudio.html#a84cc8d9b7ab9bc5f37bcf48430ec5aea">00725</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classRtAudio.html#a84cc8d9b7ab9bc5f37bcf48430ec5aea" title="Returns true if the stream is running and false if it is stopped or not open.">RtAudio :: isStreamRunning</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> rtapi_->isStreamRunning(); }
|
||||
<a name="l00726"></a><a class="code" href="classRtAudio.html#a843c989d9f501c71bc2f2c5ca18df9f3">00726</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="classRtAudio.html#a843c989d9f501c71bc2f2c5ca18df9f3" title="Returns the internal stream latency in sample frames.">RtAudio :: getStreamLatency</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> rtapi_->getStreamLatency(); }
|
||||
<a name="l00727"></a><a class="code" href="classRtAudio.html#a28214b8b05d60b45c24ee6fae7b2a0b5">00727</a> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtAudio.html#a28214b8b05d60b45c24ee6fae7b2a0b5" title="Returns actual sample rate in use by the stream.">RtAudio :: getStreamSampleRate</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> rtapi_->getStreamSampleRate(); };
|
||||
<a name="l00728"></a><a class="code" href="classRtAudio.html#a344e59a62353c5791db4621b985cb2ca">00728</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classRtAudio.html#a344e59a62353c5791db4621b985cb2ca" title="Returns the number of elapsed seconds since the stream was started.">RtAudio :: getStreamTime</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> rtapi_->getStreamTime(); }
|
||||
<a name="l00729"></a><a class="code" href="classRtAudio.html#af0752ee51cce3dd90a3bd009f9fdbe77">00729</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classRtAudio.html#af0752ee51cce3dd90a3bd009f9fdbe77" title="Specify whether warning messages should be printed to stderr.">RtAudio :: showWarnings</a>( <span class="keywordtype">bool</span> value ) <span class="keywordflow">throw</span>() { rtapi_->showWarnings( value ); }
|
||||
<a name="l00730"></a>00730
|
||||
<a name="l00731"></a>00731 <span class="comment">// RtApi Subclass prototypes.</span>
|
||||
<a name="l00732"></a>00732
|
||||
<a name="l00733"></a>00733 <span class="preprocessor">#if defined(__MACOSX_CORE__)</span>
|
||||
<a name="l00734"></a>00734 <span class="preprocessor"></span>
|
||||
<a name="l00735"></a>00735 <span class="preprocessor">#include <CoreAudio/AudioHardware.h></span>
|
||||
<a name="l00736"></a>00736
|
||||
<a name="l00737"></a>00737 <span class="keyword">class </span>RtApiCore: <span class="keyword">public</span> RtApi
|
||||
<a name="l00738"></a>00738 {
|
||||
<a name="l00739"></a>00739 <span class="keyword">public</span>:
|
||||
<a name="l00740"></a>00740
|
||||
<a name="l00741"></a>00741 RtApiCore();
|
||||
<a name="l00742"></a>00742 ~RtApiCore();
|
||||
<a name="l00743"></a>00743 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a9fec92b8272244a87a6a11a717bd662d">RtAudio::MACOSX_CORE</a>; };
|
||||
<a name="l00744"></a>00744 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> );
|
||||
<a name="l00745"></a>00745 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00746"></a>00746 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDefaultOutputDevice( <span class="keywordtype">void</span> );
|
||||
<a name="l00747"></a>00747 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDefaultInputDevice( <span class="keywordtype">void</span> );
|
||||
<a name="l00748"></a>00748 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00749"></a>00749 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00750"></a>00750 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00751"></a>00751 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00752"></a>00752 <span class="keywordtype">long</span> getStreamLatency( <span class="keywordtype">void</span> );
|
||||
<a name="l00753"></a>00753
|
||||
<a name="l00754"></a>00754 <span class="comment">// This function is intended for internal use only. It must be</span>
|
||||
<a name="l00755"></a>00755 <span class="comment">// public because it is called by the internal callback handler,</span>
|
||||
<a name="l00756"></a>00756 <span class="comment">// which is not a member of RtAudio. External use of this function</span>
|
||||
<a name="l00757"></a>00757 <span class="comment">// will most likely produce highly undesireable results!</span>
|
||||
<a name="l00758"></a>00758 <span class="keywordtype">bool</span> callbackEvent( AudioDeviceID deviceId,
|
||||
<a name="l00759"></a>00759 <span class="keyword">const</span> AudioBufferList *inBufferList,
|
||||
<a name="l00760"></a>00760 <span class="keyword">const</span> AudioBufferList *outBufferList );
|
||||
<a name="l00761"></a>00761
|
||||
<a name="l00762"></a>00762 <span class="keyword">private</span>:
|
||||
<a name="l00763"></a>00763
|
||||
<a name="l00764"></a>00764 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00765"></a>00765 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00766"></a>00766 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00767"></a>00767 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00768"></a>00768 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* getErrorCode( OSStatus code );
|
||||
<a name="l00769"></a>00769 };
|
||||
<a name="l00770"></a>00770
|
||||
<a name="l00771"></a>00771 <span class="preprocessor">#endif</span>
|
||||
<a name="l00772"></a>00772 <span class="preprocessor"></span>
|
||||
<a name="l00773"></a>00773 <span class="preprocessor">#if defined(__UNIX_JACK__)</span>
|
||||
<a name="l00774"></a>00774 <span class="preprocessor"></span>
|
||||
<a name="l00775"></a>00775 <span class="keyword">class </span>RtApiJack: <span class="keyword">public</span> RtApi
|
||||
<a name="l00776"></a>00776 {
|
||||
<a name="l00777"></a>00777 <span class="keyword">public</span>:
|
||||
<a name="l00778"></a>00778
|
||||
<a name="l00779"></a>00779 RtApiJack();
|
||||
<a name="l00780"></a>00780 ~RtApiJack();
|
||||
<a name="l00781"></a>00781 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a4767e17c6edfbd827f91763915df4105">RtAudio::UNIX_JACK</a>; };
|
||||
<a name="l00782"></a>00782 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> );
|
||||
<a name="l00783"></a>00783 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00784"></a>00784 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00785"></a>00785 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00786"></a>00786 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00787"></a>00787 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00788"></a>00788 <span class="keywordtype">long</span> getStreamLatency( <span class="keywordtype">void</span> );
|
||||
<a name="l00789"></a>00789
|
||||
<a name="l00790"></a>00790 <span class="comment">// This function is intended for internal use only. It must be</span>
|
||||
<a name="l00791"></a>00791 <span class="comment">// public because it is called by the internal callback handler,</span>
|
||||
<a name="l00792"></a>00792 <span class="comment">// which is not a member of RtAudio. External use of this function</span>
|
||||
<a name="l00793"></a>00793 <span class="comment">// will most likely produce highly undesireable results!</span>
|
||||
<a name="l00794"></a>00794 <span class="keywordtype">bool</span> callbackEvent( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nframes );
|
||||
<a name="l00795"></a>00795
|
||||
<a name="l00796"></a>00796 <span class="keyword">private</span>:
|
||||
<a name="l00797"></a>00797
|
||||
<a name="l00798"></a>00798 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00799"></a>00799 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00800"></a>00800 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00801"></a>00801 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00802"></a>00802 };
|
||||
<a name="l00803"></a>00803
|
||||
<a name="l00804"></a>00804 <span class="preprocessor">#endif</span>
|
||||
<a name="l00805"></a>00805 <span class="preprocessor"></span>
|
||||
<a name="l00806"></a>00806 <span class="preprocessor">#if defined(__WINDOWS_ASIO__)</span>
|
||||
<a name="l00807"></a>00807 <span class="preprocessor"></span>
|
||||
<a name="l00808"></a>00808 <span class="keyword">class </span>RtApiAsio: <span class="keyword">public</span> RtApi
|
||||
<a name="l00809"></a>00809 {
|
||||
<a name="l00810"></a>00810 <span class="keyword">public</span>:
|
||||
<a name="l00811"></a>00811
|
||||
<a name="l00812"></a>00812 RtApiAsio();
|
||||
<a name="l00813"></a>00813 ~RtApiAsio();
|
||||
<a name="l00814"></a>00814 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a219517d1df90f94d07758481155bd469">RtAudio::WINDOWS_ASIO</a>; };
|
||||
<a name="l00815"></a>00815 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> );
|
||||
<a name="l00816"></a>00816 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00817"></a>00817 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00818"></a>00818 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00819"></a>00819 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00820"></a>00820 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00821"></a>00821 <span class="keywordtype">long</span> getStreamLatency( <span class="keywordtype">void</span> );
|
||||
<a name="l00822"></a>00822
|
||||
<a name="l00823"></a>00823 <span class="comment">// This function is intended for internal use only. It must be</span>
|
||||
<a name="l00824"></a>00824 <span class="comment">// public because it is called by the internal callback handler,</span>
|
||||
<a name="l00825"></a>00825 <span class="comment">// which is not a member of RtAudio. External use of this function</span>
|
||||
<a name="l00826"></a>00826 <span class="comment">// will most likely produce highly undesireable results!</span>
|
||||
<a name="l00827"></a>00827 <span class="keywordtype">bool</span> callbackEvent( <span class="keywordtype">long</span> bufferIndex );
|
||||
<a name="l00828"></a>00828
|
||||
<a name="l00829"></a>00829 <span class="keyword">private</span>:
|
||||
<a name="l00830"></a>00830
|
||||
<a name="l00831"></a>00831 std::vector<RtAudio::DeviceInfo> devices_;
|
||||
<a name="l00832"></a>00832 <span class="keywordtype">void</span> saveDeviceInfo( <span class="keywordtype">void</span> );
|
||||
<a name="l00833"></a>00833 <span class="keywordtype">bool</span> coInitialized_;
|
||||
<a name="l00834"></a>00834 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00835"></a>00835 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00836"></a>00836 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00837"></a>00837 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00838"></a>00838 };
|
||||
<a name="l00839"></a>00839
|
||||
<a name="l00840"></a>00840 <span class="preprocessor">#endif</span>
|
||||
<a name="l00841"></a>00841 <span class="preprocessor"></span>
|
||||
<a name="l00842"></a>00842 <span class="preprocessor">#if defined(__WINDOWS_DS__)</span>
|
||||
<a name="l00843"></a>00843 <span class="preprocessor"></span>
|
||||
<a name="l00844"></a>00844 <span class="keyword">class </span>RtApiDs: <span class="keyword">public</span> RtApi
|
||||
<a name="l00845"></a>00845 {
|
||||
<a name="l00846"></a>00846 <span class="keyword">public</span>:
|
||||
<a name="l00847"></a>00847
|
||||
<a name="l00848"></a>00848 RtApiDs();
|
||||
<a name="l00849"></a>00849 ~RtApiDs();
|
||||
<a name="l00850"></a>00850 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a28478830f42c2fd61e6c7ad498901931">RtAudio::WINDOWS_DS</a>; };
|
||||
<a name="l00851"></a>00851 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> );
|
||||
<a name="l00852"></a>00852 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDefaultOutputDevice( <span class="keywordtype">void</span> );
|
||||
<a name="l00853"></a>00853 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDefaultInputDevice( <span class="keywordtype">void</span> );
|
||||
<a name="l00854"></a>00854 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00855"></a>00855 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00856"></a>00856 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00857"></a>00857 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00858"></a>00858 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00859"></a>00859 <span class="keywordtype">long</span> getStreamLatency( <span class="keywordtype">void</span> );
|
||||
<a name="l00860"></a>00860
|
||||
<a name="l00861"></a>00861 <span class="comment">// This function is intended for internal use only. It must be</span>
|
||||
<a name="l00862"></a>00862 <span class="comment">// public because it is called by the internal callback handler,</span>
|
||||
<a name="l00863"></a>00863 <span class="comment">// which is not a member of RtAudio. External use of this function</span>
|
||||
<a name="l00864"></a>00864 <span class="comment">// will most likely produce highly undesireable results!</span>
|
||||
<a name="l00865"></a>00865 <span class="keywordtype">void</span> callbackEvent( <span class="keywordtype">void</span> );
|
||||
<a name="l00866"></a>00866
|
||||
<a name="l00867"></a>00867 <span class="keyword">private</span>:
|
||||
<a name="l00868"></a>00868
|
||||
<a name="l00869"></a>00869 <span class="keywordtype">bool</span> coInitialized_;
|
||||
<a name="l00870"></a>00870 <span class="keywordtype">bool</span> buffersRolling;
|
||||
<a name="l00871"></a>00871 <span class="keywordtype">long</span> duplexPrerollBytes;
|
||||
<a name="l00872"></a>00872 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00873"></a>00873 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00874"></a>00874 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00875"></a>00875 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00876"></a>00876 };
|
||||
<a name="l00877"></a>00877
|
||||
<a name="l00878"></a>00878 <span class="preprocessor">#endif</span>
|
||||
<a name="l00879"></a>00879 <span class="preprocessor"></span>
|
||||
<a name="l00880"></a>00880 <span class="preprocessor">#if defined(__LINUX_ALSA__)</span>
|
||||
<a name="l00881"></a>00881 <span class="preprocessor"></span>
|
||||
<a name="l00882"></a>00882 <span class="keyword">class </span>RtApiAlsa: <span class="keyword">public</span> RtApi
|
||||
<a name="l00883"></a>00883 {
|
||||
<a name="l00884"></a>00884 <span class="keyword">public</span>:
|
||||
<a name="l00885"></a>00885
|
||||
<a name="l00886"></a>00886 RtApiAlsa();
|
||||
<a name="l00887"></a>00887 ~RtApiAlsa();
|
||||
<a name="l00888"></a>00888 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi() { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849aa7a2ba095c2806caa893b6fb8fc3a1a8">RtAudio::LINUX_ALSA</a>; };
|
||||
<a name="l00889"></a>00889 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> );
|
||||
<a name="l00890"></a>00890 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00891"></a>00891 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00892"></a>00892 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00893"></a>00893 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00894"></a>00894 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00895"></a>00895
|
||||
<a name="l00896"></a>00896 <span class="comment">// This function is intended for internal use only. It must be</span>
|
||||
<a name="l00897"></a>00897 <span class="comment">// public because it is called by the internal callback handler,</span>
|
||||
<a name="l00898"></a>00898 <span class="comment">// which is not a member of RtAudio. External use of this function</span>
|
||||
<a name="l00899"></a>00899 <span class="comment">// will most likely produce highly undesireable results!</span>
|
||||
<a name="l00900"></a>00900 <span class="keywordtype">void</span> callbackEvent( <span class="keywordtype">void</span> );
|
||||
<a name="l00901"></a>00901
|
||||
<a name="l00902"></a>00902 <span class="keyword">private</span>:
|
||||
<a name="l00903"></a>00903
|
||||
<a name="l00904"></a>00904 std::vector<RtAudio::DeviceInfo> devices_;
|
||||
<a name="l00905"></a>00905 <span class="keywordtype">void</span> saveDeviceInfo( <span class="keywordtype">void</span> );
|
||||
<a name="l00906"></a>00906 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00907"></a>00907 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00908"></a>00908 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00909"></a>00909 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00910"></a>00910 };
|
||||
<a name="l00911"></a>00911
|
||||
<a name="l00912"></a>00912 <span class="preprocessor">#endif</span>
|
||||
<a name="l00913"></a>00913 <span class="preprocessor"></span>
|
||||
<a name="l00914"></a>00914 <span class="preprocessor">#if defined(__LINUX_OSS__)</span>
|
||||
<a name="l00915"></a>00915 <span class="preprocessor"></span>
|
||||
<a name="l00916"></a>00916 <span class="keyword">class </span>RtApiOss: <span class="keyword">public</span> RtApi
|
||||
<a name="l00917"></a>00917 {
|
||||
<a name="l00918"></a>00918 <span class="keyword">public</span>:
|
||||
<a name="l00919"></a>00919
|
||||
<a name="l00920"></a>00920 RtApiOss();
|
||||
<a name="l00921"></a>00921 ~RtApiOss();
|
||||
<a name="l00922"></a>00922 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi() { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849a39c84615e61de75e6a4e865596d62c82">RtAudio::LINUX_OSS</a>; };
|
||||
<a name="l00923"></a>00923 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> );
|
||||
<a name="l00924"></a>00924 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device );
|
||||
<a name="l00925"></a>00925 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00926"></a>00926 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00927"></a>00927 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00928"></a>00928 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> );
|
||||
<a name="l00929"></a>00929
|
||||
<a name="l00930"></a>00930 <span class="comment">// This function is intended for internal use only. It must be</span>
|
||||
<a name="l00931"></a>00931 <span class="comment">// public because it is called by the internal callback handler,</span>
|
||||
<a name="l00932"></a>00932 <span class="comment">// which is not a member of RtAudio. External use of this function</span>
|
||||
<a name="l00933"></a>00933 <span class="comment">// will most likely produce highly undesireable results!</span>
|
||||
<a name="l00934"></a>00934 <span class="keywordtype">void</span> callbackEvent( <span class="keywordtype">void</span> );
|
||||
<a name="l00935"></a>00935
|
||||
<a name="l00936"></a>00936 <span class="keyword">private</span>:
|
||||
<a name="l00937"></a>00937
|
||||
<a name="l00938"></a>00938 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00939"></a>00939 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00940"></a>00940 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00941"></a>00941 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options );
|
||||
<a name="l00942"></a>00942 };
|
||||
<a name="l00943"></a>00943
|
||||
<a name="l00944"></a>00944 <span class="preprocessor">#endif</span>
|
||||
<a name="l00945"></a>00945 <span class="preprocessor"></span>
|
||||
<a name="l00946"></a>00946 <span class="preprocessor">#if defined(__RTAUDIO_DUMMY__)</span>
|
||||
<a name="l00947"></a>00947 <span class="preprocessor"></span>
|
||||
<a name="l00948"></a>00948 <span class="keyword">class </span>RtApiDummy: <span class="keyword">public</span> RtApi
|
||||
<a name="l00949"></a>00949 {
|
||||
<a name="l00950"></a>00950 <span class="keyword">public</span>:
|
||||
<a name="l00951"></a>00951
|
||||
<a name="l00952"></a>00952 RtApiDummy() { errorText_ = <span class="stringliteral">"RtApiDummy: This class provides no functionality."</span>; error( <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca3a1603c24a56cbdaf5f8ae4ddcb86398">RtError::WARNING</a> ); };
|
||||
<a name="l00953"></a>00953 <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849" title="Audio API specifier arguments.">RtAudio::Api</a> getCurrentApi( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> <a class="code" href="classRtAudio.html#ac9b6f625da88249d08a8409a9db0d849ab06b8fd88bf18c9a2b8271f6961ae2d1">RtAudio::RTAUDIO_DUMMY</a>; };
|
||||
<a name="l00954"></a>00954 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getDeviceCount( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> 0; };
|
||||
<a name="l00955"></a>00955 <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> getDeviceInfo( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device ) { <a class="code" href="structRtAudio_1_1DeviceInfo.html" title="The public device information structure for returning queried values.">RtAudio::DeviceInfo</a> info; <span class="keywordflow">return</span> info; };
|
||||
<a name="l00956"></a>00956 <span class="keywordtype">void</span> closeStream( <span class="keywordtype">void</span> ) {};
|
||||
<a name="l00957"></a>00957 <span class="keywordtype">void</span> startStream( <span class="keywordtype">void</span> ) {};
|
||||
<a name="l00958"></a>00958 <span class="keywordtype">void</span> stopStream( <span class="keywordtype">void</span> ) {};
|
||||
<a name="l00959"></a>00959 <span class="keywordtype">void</span> abortStream( <span class="keywordtype">void</span> ) {};
|
||||
<a name="l00960"></a>00960
|
||||
<a name="l00961"></a>00961 <span class="keyword">private</span>:
|
||||
<a name="l00962"></a>00962
|
||||
<a name="l00963"></a>00963 <span class="keywordtype">bool</span> probeDeviceOpen( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> device, StreamMode mode, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels,
|
||||
<a name="l00964"></a>00964 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> firstChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sampleRate,
|
||||
<a name="l00965"></a>00965 <a class="code" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8" title="RtAudio data format type.">RtAudioFormat</a> format, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> *bufferSize,
|
||||
<a name="l00966"></a>00966 <a class="code" href="structRtAudio_1_1StreamOptions.html" title="The structure for specifying stream options.">RtAudio::StreamOptions</a> *options ) { <span class="keywordflow">return</span> <span class="keyword">false</span>; };
|
||||
<a name="l00967"></a>00967 };
|
||||
<a name="l00968"></a>00968
|
||||
<a name="l00969"></a>00969 <span class="preprocessor">#endif</span>
|
||||
<a name="l00970"></a>00970 <span class="preprocessor"></span>
|
||||
<a name="l00971"></a>00971 <span class="preprocessor">#endif</span>
|
||||
<a name="l00972"></a>00972 <span class="preprocessor"></span>
|
||||
<a name="l00973"></a>00973 <span class="comment">// Indentation settings for Vim and Emacs</span>
|
||||
<a name="l00974"></a>00974 <span class="comment">//</span>
|
||||
<a name="l00975"></a>00975 <span class="comment">// Local Variables:</span>
|
||||
<a name="l00976"></a>00976 <span class="comment">// c-basic-offset: 2</span>
|
||||
<a name="l00977"></a>00977 <span class="comment">// indent-tabs-mode: nil</span>
|
||||
<a name="l00978"></a>00978 <span class="comment">// End:</span>
|
||||
<a name="l00979"></a>00979 <span class="comment">//</span>
|
||||
<a name="l00980"></a>00980 <span class="comment">// vim: et sts=2 sw=2</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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
69
doc/html/RtError_8h_source.html
Normal file
69
doc/html/RtError_8h_source.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>RtError.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/************************************************************************/</span>
|
||||
<a name="l00010"></a>00010 <span class="comment">/************************************************************************/</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="preprocessor">#ifndef RTERROR_H</span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#define RTERROR_H</span>
|
||||
<a name="l00014"></a>00014 <span class="preprocessor"></span>
|
||||
<a name="l00015"></a>00015 <span class="preprocessor">#include <exception></span>
|
||||
<a name="l00016"></a>00016 <span class="preprocessor">#include <iostream></span>
|
||||
<a name="l00017"></a>00017 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classRtError.html">00019</a> <span class="keyword">class </span><a class="code" href="classRtError.html" title="Exception handling class for RtAudio &amp; RtMidi.">RtError</a> : <span class="keyword">public</span> std::exception
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac">00023</a> <span class="keyword">enum</span> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a> {
|
||||
<a name="l00024"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca3a1603c24a56cbdaf5f8ae4ddcb86398">00024</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca3a1603c24a56cbdaf5f8ae4ddcb86398">WARNING</a>,
|
||||
<a name="l00025"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca20e5a369394d19b704ace17002007eba">00025</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca20e5a369394d19b704ace17002007eba">DEBUG_WARNING</a>,
|
||||
<a name="l00026"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca444efd3ccf774b2ba9f9bde70ec71cd6">00026</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca444efd3ccf774b2ba9f9bde70ec71cd6">UNSPECIFIED</a>,
|
||||
<a name="l00027"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaf267eb2d710f33d649ba840eeab6ff82">00027</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaf267eb2d710f33d649ba840eeab6ff82">NO_DEVICES_FOUND</a>,
|
||||
<a name="l00028"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acad6064062066fffdba258237a7c2159b1">00028</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acad6064062066fffdba258237a7c2159b1">INVALID_DEVICE</a>,
|
||||
<a name="l00029"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acab4f813e5a36905c89d4081a59497432e">00029</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acab4f813e5a36905c89d4081a59497432e">MEMORY_ERROR</a>,
|
||||
<a name="l00030"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaa3eabf0f71120beaba94148a1b78fed6">00030</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaa3eabf0f71120beaba94148a1b78fed6">INVALID_PARAMETER</a>,
|
||||
<a name="l00031"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8e65f51a3fbdc1a4a1552b3260df36bc">00031</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8e65f51a3fbdc1a4a1552b3260df36bc">INVALID_USE</a>,
|
||||
<a name="l00032"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca995e97ecf6beeedaba525022a63aec6b">00032</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca995e97ecf6beeedaba525022a63aec6b">DRIVER_ERROR</a>,
|
||||
<a name="l00033"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8947d0a2e2a84ecf3646271844e06a6b">00033</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca8947d0a2e2a84ecf3646271844e06a6b">SYSTEM_ERROR</a>,
|
||||
<a name="l00034"></a><a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaeb6282f991e2d93ab294a4272fc3f6c6">00034</a> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903acaeb6282f991e2d93ab294a4272fc3f6c6">THREAD_ERROR</a>
|
||||
<a name="l00035"></a>00035 };
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a><a class="code" href="classRtError.html#aa479a305ccbe56be0fd9137b9b405a37">00038</a> <a class="code" href="classRtError.html#aa479a305ccbe56be0fd9137b9b405a37" title="The constructor.">RtError</a>( <span class="keyword">const</span> std::string& message, <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a> type = <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903aca444efd3ccf774b2ba9f9bde70ec71cd6">RtError::UNSPECIFIED</a> ) throw() : message_(message), type_(type) {}
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a><a class="code" href="classRtError.html#a6793e03386e7e69ffafb65a296dfa48c">00041</a> <span class="keyword">virtual</span> <a class="code" href="classRtError.html#a6793e03386e7e69ffafb65a296dfa48c" title="The destructor.">~RtError</a>( <span class="keywordtype">void</span> ) throw() {}
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a><a class="code" href="classRtError.html#a251dcdac396c998c91706dd2dd3b8bfc">00044</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtError.html#a251dcdac396c998c91706dd2dd3b8bfc" title="Prints thrown error message to stderr.">printMessage</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span> throw() { std::cerr << <span class="charliteral">'\n'</span> << message_ << <span class="stringliteral">"\n\n"</span>; }
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a><a class="code" href="classRtError.html#a3e316dc9b9b41fe2f64cabf34beb4fe7">00047</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a>& <a class="code" href="classRtError.html#a3e316dc9b9b41fe2f64cabf34beb4fe7" title="Returns the thrown error message type.">getType</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> type_; }
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a><a class="code" href="classRtError.html#afd067ba6b46edd37f989cad02cd70b50">00050</a> <span class="keyword">virtual</span> <span class="keyword">const</span> std::string& <a class="code" href="classRtError.html#afd067ba6b46edd37f989cad02cd70b50" title="Returns the thrown error message string.">getMessage</a>(<span class="keywordtype">void</span>) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> message_; }
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a><a class="code" href="classRtError.html#aeb843b7a7785d66061c61ebfc29e7e9d">00053</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classRtError.html#aeb843b7a7785d66061c61ebfc29e7e9d" title="Returns the thrown error message as a c-style string.">what</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span> throw() { <span class="keywordflow">return</span> message_.c_str(); }
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00055"></a>00055 <span class="keyword">protected</span>:
|
||||
<a name="l00056"></a>00056 std::string message_;
|
||||
<a name="l00057"></a>00057 <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">Type</a> type_;
|
||||
<a name="l00058"></a>00058 };
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00060"></a>00060 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
190
doc/html/RtMidi_8h_source.html
Normal file
190
doc/html/RtMidi_8h_source.html
Normal file
@@ -0,0 +1,190 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>RtMidi.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00036"></a>00036 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a>00038 <span class="comment">// RtMidi: Version 1.0.15</span>
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00040"></a>00040 <span class="preprocessor">#ifndef RTMIDI_H</span>
|
||||
<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#define RTMIDI_H</span>
|
||||
<a name="l00042"></a>00042 <span class="preprocessor"></span>
|
||||
<a name="l00043"></a>00043 <span class="preprocessor">#include "RtError.h"</span>
|
||||
<a name="l00044"></a>00044 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00046"></a><a class="code" href="classRtMidi.html">00046</a> <span class="keyword">class </span><a class="code" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>
|
||||
<a name="l00047"></a>00047 {
|
||||
<a name="l00048"></a>00048 <span class="keyword">public</span>:
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtMidi.html#ad9e30a89638f93193cb40edebaa536f5" title="Pure virtual openPort() function.">openPort</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> portNumber = 0, <span class="keyword">const</span> std::string portName = std::string( <span class="stringliteral">"RtMidi"</span> ) ) = 0;
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtMidi.html#a9200cde4f5337c0bc421d20bd4fcf654" title="Pure virtual openVirtualPort() function.">openVirtualPort</a>( <span class="keyword">const</span> std::string portName = std::string( <span class="stringliteral">"RtMidi"</span> ) ) = 0;
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtMidi.html#a9a49ef73a1e6007444019a7ae095e195" title="Pure virtual getPortCount() function.">getPortCount</a>() = 0;
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keyword">virtual</span> std::string <a class="code" href="classRtMidi.html#a799e2b9f4df39b298518f2b394db3391" title="Pure virtual getPortName() function.">getPortName</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> portNumber = 0 ) = 0;
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classRtMidi.html#a36125c4fa16550345b57f4a4927f5b4a" title="Pure virtual closePort() function.">closePort</a>( <span class="keywordtype">void</span> ) = 0;
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <span class="keyword">protected</span>:
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00067"></a>00067 <a class="code" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>();
|
||||
<a name="l00068"></a>00068 <span class="keyword">virtual</span> ~<a class="code" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>() {};
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="comment">// A basic error reporting function for internal use in the RtMidi</span>
|
||||
<a name="l00071"></a>00071 <span class="comment">// subclasses. The behavior of this function can be modified to</span>
|
||||
<a name="l00072"></a>00072 <span class="comment">// suit specific needs.</span>
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> error( <a class="code" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac" title="Defined RtError types.">RtError::Type</a> type );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> *apiData_;
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">bool</span> connected_;
|
||||
<a name="l00077"></a>00077 std::string errorString_;
|
||||
<a name="l00078"></a>00078 };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00096"></a>00096 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classRtMidiIn.html">00100</a> <span class="keyword">class </span><a class="code" href="classRtMidiIn.html" title="A realtime MIDI input class.">RtMidiIn</a> : <span class="keyword">public</span> <a class="code" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="keyword">public</span>:
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00105"></a><a class="code" href="classRtMidiIn.html#a297d2eb3c3420b437970a6fc59d89cbf">00105</a> <span class="keyword">typedef</span> void (*<a class="code" href="classRtMidiIn.html#a297d2eb3c3420b437970a6fc59d89cbf" title="User callback function type definition.">RtMidiCallback</a>)( <span class="keywordtype">double</span> timeStamp, std::vector<unsigned char> *message, <span class="keywordtype">void</span> *userData);
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00115"></a>00115 <a class="code" href="classRtMidiIn.html#a1d70da3ef18d24c5b3f0cc01888e093d" title="Default constructor that allows an optional client name and queue size.">RtMidiIn</a>( <span class="keyword">const</span> std::string clientName = std::string( <span class="stringliteral">"RtMidi Input Client"</span>), <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> queueSizeLimit = 100 );
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00118"></a>00118 <a class="code" href="classRtMidiIn.html#af865d88c154b6fdadc640da5dc278d40" title="If a MIDI connection is still open, it will be closed by the destructor.">~RtMidiIn</a>();
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">void</span> <a class="code" href="classRtMidiIn.html#a7e853661b1056083e07318d67c51f6fd" title="Open a MIDI input connection.">openPort</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> portNumber = 0, <span class="keyword">const</span> std::string Portname = std::string( <span class="stringliteral">"RtMidi Input"</span> ) );
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">void</span> <a class="code" href="classRtMidiIn.html#a245261b3f12ce727faed18fcfeef18c2" title="Create a virtual input port, with optional name, to allow software connections (OS...">openVirtualPort</a>( <span class="keyword">const</span> std::string portName = std::string( <span class="stringliteral">"RtMidi Input"</span> ) );
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00143"></a>00143 <span class="keywordtype">void</span> <a class="code" href="classRtMidiIn.html#a7590563461c7467608a4b3806406b32d" title="Set a callback function to be invoked for incoming MIDI messages.">setCallback</a>( <a class="code" href="classRtMidiIn.html#a297d2eb3c3420b437970a6fc59d89cbf" title="User callback function type definition.">RtMidiCallback</a> callback, <span class="keywordtype">void</span> *userData = 0 );
|
||||
<a name="l00144"></a>00144
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00150"></a>00150 <span class="keywordtype">void</span> <a class="code" href="classRtMidiIn.html#ade23832a66c1ed56965c26325602543e" title="Cancel use of the current callback function (if one exists).">cancelCallback</a>();
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00153"></a>00153 <span class="keywordtype">void</span> <a class="code" href="classRtMidiIn.html#a55bacf0d228fd8e3be6a79d12fd1dc39" title="Close an open MIDI connection (if one exists).">closePort</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00156"></a>00156 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtMidiIn.html#a62b1b38aa8e5f11cd66f03d59228f4e4" title="Return the number of available MIDI input ports.">getPortCount</a>();
|
||||
<a name="l00157"></a>00157
|
||||
<a name="l00159"></a>00159
|
||||
<a name="l00162"></a>00162 std::string <a class="code" href="classRtMidiIn.html#af2961fff09fa01a3d5bc0f0c5a042aaf" title="Return a string identifier for the specified MIDI input port number.">getPortName</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> portNumber = 0 );
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00172"></a>00172 <span class="keywordtype">void</span> <a class="code" href="classRtMidiIn.html#af9507125aaa42276ccc01df576fc3533" title="Specify whether certain MIDI message types should be queued or ignored during input...">ignoreTypes</a>( <span class="keywordtype">bool</span> midiSysex = <span class="keyword">true</span>, <span class="keywordtype">bool</span> midiTime = <span class="keyword">true</span>, <span class="keywordtype">bool</span> midiSense = <span class="keyword">true</span> );
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00175"></a>00175
|
||||
<a name="l00182"></a>00182 <span class="keywordtype">double</span> <a class="code" href="classRtMidiIn.html#a1ba10ecd276b30a8579c7d60a9c890eb" title="Fill the user-provided vector with the data bytes for the next available MIDI message...">getMessage</a>( std::vector<unsigned char> *message );
|
||||
<a name="l00183"></a>00183
|
||||
<a name="l00184"></a>00184 <span class="comment">// A MIDI structure used internally by the class to store incoming</span>
|
||||
<a name="l00185"></a>00185 <span class="comment">// messages. Each message represents one and only one MIDI message.</span>
|
||||
<a name="l00186"></a>00186 <span class="keyword">struct </span>MidiMessage {
|
||||
<a name="l00187"></a>00187 std::vector<unsigned char> bytes;
|
||||
<a name="l00188"></a>00188 <span class="keywordtype">double</span> timeStamp;
|
||||
<a name="l00189"></a>00189
|
||||
<a name="l00190"></a>00190 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00191"></a>00191 MidiMessage()
|
||||
<a name="l00192"></a>00192 :bytes(0), timeStamp(0.0) {}
|
||||
<a name="l00193"></a>00193 };
|
||||
<a name="l00194"></a>00194
|
||||
<a name="l00195"></a>00195 <span class="keyword">struct </span>MidiQueue {
|
||||
<a name="l00196"></a>00196 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> front;
|
||||
<a name="l00197"></a>00197 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> back;
|
||||
<a name="l00198"></a>00198 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size;
|
||||
<a name="l00199"></a>00199 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ringSize;
|
||||
<a name="l00200"></a>00200 MidiMessage *ring;
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00202"></a>00202 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00203"></a>00203 MidiQueue()
|
||||
<a name="l00204"></a>00204 :front(0), back(0), size(0), ringSize(0) {}
|
||||
<a name="l00205"></a>00205 };
|
||||
<a name="l00206"></a>00206
|
||||
<a name="l00207"></a>00207 <span class="comment">// The RtMidiInData structure is used to pass private class data to</span>
|
||||
<a name="l00208"></a>00208 <span class="comment">// the MIDI input handling function or thread.</span>
|
||||
<a name="l00209"></a>00209 <span class="keyword">struct </span>RtMidiInData {
|
||||
<a name="l00210"></a>00210 MidiQueue queue;
|
||||
<a name="l00211"></a>00211 MidiMessage message;
|
||||
<a name="l00212"></a>00212 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ignoreFlags;
|
||||
<a name="l00213"></a>00213 <span class="keywordtype">bool</span> doInput;
|
||||
<a name="l00214"></a>00214 <span class="keywordtype">bool</span> firstMessage;
|
||||
<a name="l00215"></a>00215 <span class="keywordtype">void</span> *apiData;
|
||||
<a name="l00216"></a>00216 <span class="keywordtype">bool</span> usingCallback;
|
||||
<a name="l00217"></a>00217 <span class="keywordtype">void</span> *userCallback;
|
||||
<a name="l00218"></a>00218 <span class="keywordtype">void</span> *userData;
|
||||
<a name="l00219"></a>00219 <span class="keywordtype">bool</span> continueSysex;
|
||||
<a name="l00220"></a>00220
|
||||
<a name="l00221"></a>00221 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00222"></a>00222 RtMidiInData()
|
||||
<a name="l00223"></a>00223 : ignoreFlags(7), doInput(false), firstMessage(true),
|
||||
<a name="l00224"></a>00224 apiData(0), usingCallback(false), userCallback(0), userData(0),
|
||||
<a name="l00225"></a>00225 continueSysex(false) {}
|
||||
<a name="l00226"></a>00226 };
|
||||
<a name="l00227"></a>00227
|
||||
<a name="l00228"></a>00228 <span class="keyword">private</span>:
|
||||
<a name="l00229"></a>00229
|
||||
<a name="l00230"></a>00230 <span class="keywordtype">void</span> initialize( <span class="keyword">const</span> std::string& clientName );
|
||||
<a name="l00231"></a>00231 RtMidiInData inputData_;
|
||||
<a name="l00232"></a>00232
|
||||
<a name="l00233"></a>00233 };
|
||||
<a name="l00234"></a>00234
|
||||
<a name="l00235"></a>00235 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00247"></a>00247 <span class="comment">/**********************************************************************/</span>
|
||||
<a name="l00248"></a>00248
|
||||
<a name="l00249"></a><a class="code" href="classRtMidiOut.html">00249</a> <span class="keyword">class </span><a class="code" href="classRtMidiOut.html" title="A realtime MIDI output class.">RtMidiOut</a> : <span class="keyword">public</span> <a class="code" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>
|
||||
<a name="l00250"></a>00250 {
|
||||
<a name="l00251"></a>00251 <span class="keyword">public</span>:
|
||||
<a name="l00252"></a>00252
|
||||
<a name="l00254"></a>00254
|
||||
<a name="l00257"></a>00257 <a class="code" href="classRtMidiOut.html#a8ed1b492900f3410bf91ad53203b9db3" title="Default constructor that allows an optional client name.">RtMidiOut</a>( <span class="keyword">const</span> std::string clientName = std::string( <span class="stringliteral">"RtMidi Output Client"</span> ) );
|
||||
<a name="l00258"></a>00258
|
||||
<a name="l00260"></a>00260 <a class="code" href="classRtMidiOut.html#ab776c431bd84193febb2f78fb8c7e792" title="The destructor closes any open MIDI connections.">~RtMidiOut</a>();
|
||||
<a name="l00261"></a>00261
|
||||
<a name="l00263"></a>00263
|
||||
<a name="l00269"></a>00269 <span class="keywordtype">void</span> <a class="code" href="classRtMidiOut.html#a1b280d67317cd473a8816aeb2fe6c186" title="Open a MIDI output connection.">openPort</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> portNumber = 0, <span class="keyword">const</span> std::string portName = std::string( <span class="stringliteral">"RtMidi Output"</span> ) );
|
||||
<a name="l00270"></a>00270
|
||||
<a name="l00272"></a>00272 <span class="keywordtype">void</span> <a class="code" href="classRtMidiOut.html#a3092e53a8aed2d3b163fcaa05fafd041" title="Close an open MIDI connection (if one exists).">closePort</a>();
|
||||
<a name="l00273"></a>00273
|
||||
<a name="l00275"></a>00275
|
||||
<a name="l00283"></a>00283 <span class="keywordtype">void</span> <a class="code" href="classRtMidiOut.html#a47068e1c076d91fd89587c0ccdeddc7a" title="Create a virtual output port, with optional name, to allow software connections (OS...">openVirtualPort</a>( <span class="keyword">const</span> std::string portName = std::string( <span class="stringliteral">"RtMidi Output"</span> ) );
|
||||
<a name="l00284"></a>00284
|
||||
<a name="l00286"></a>00286 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classRtMidiOut.html#ad6cddbcc7faa20a7be229f765ade0877" title="Return the number of available MIDI output ports.">getPortCount</a>();
|
||||
<a name="l00287"></a>00287
|
||||
<a name="l00289"></a>00289
|
||||
<a name="l00292"></a>00292 std::string <a class="code" href="classRtMidiOut.html#acc4ae0ab71a49ae7629075d5a9cd837c" title="Return a string identifier for the specified MIDI port type and number.">getPortName</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> portNumber = 0 );
|
||||
<a name="l00293"></a>00293
|
||||
<a name="l00295"></a>00295
|
||||
<a name="l00299"></a>00299 <span class="keywordtype">void</span> <a class="code" href="classRtMidiOut.html#a0bd8972ef8ac4e8d37ccc4b5d51c2eb3" title="Immediately send a single message out an open MIDI output port.">sendMessage</a>( std::vector<unsigned char> *message );
|
||||
<a name="l00300"></a>00300
|
||||
<a name="l00301"></a>00301 <span class="keyword">private</span>:
|
||||
<a name="l00302"></a>00302
|
||||
<a name="l00303"></a>00303 <span class="keywordtype">void</span> initialize( <span class="keyword">const</span> std::string& clientName );
|
||||
<a name="l00304"></a>00304 };
|
||||
<a name="l00305"></a>00305
|
||||
<a name="l00306"></a>00306 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
90
doc/html/RtWvIn_8h_source.html
Normal file
90
doc/html/RtWvIn_8h_source.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>RtWvIn.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_RTWVIN_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_RTWVIN_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvIn.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "<a class="code" href="RtAudio_8h.html">RtAudio.h</a>"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1RtWvIn.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">RtWvIn</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1RtWvIn.html#ab84c98c568346d1ad86251961f7d1fba" title="Default constructor.">RtWvIn</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, StkFloat <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">sampleRate</a> = <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>(),
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">int</span> device = 0, <span class="keywordtype">int</span> bufferFrames = RT_BUFFER_SIZE, <span class="keywordtype">int</span> nBuffers = 20 );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1RtWvIn.html#aefae2caa7f77522e8baa4908e3157f4d" title="Class destructor.">~RtWvIn</a>();
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1RtWvIn.html#a0ae4012cb269fb70536611b9116142fa" title="Start the audio input stream.">start</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1RtWvIn.html#a39d0d9702569ee3afa769309e8b2e152" title="Stop the audio input stream.">stop</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00072"></a>00072 StkFloat <a class="code" href="classstk_1_1RtWvIn.html#a3a4f4035fc01fee4c2423791f9e9317e" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00084"></a>00084 StkFloat <a class="code" href="classstk_1_1RtWvIn.html#ad2ace75cfe44dd82dd706d2c8dac7901" title="Compute a sample frame and return the specified channel value.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1RtWvIn.html#ad2ace75cfe44dd82dd706d2c8dac7901" title="Compute a sample frame and return the specified channel value.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="comment">// This function is not intended for general use but must be</span>
|
||||
<a name="l00097"></a>00097 <span class="comment">// public for access from the audio callback function.</span>
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">void</span> fillBuffer( <span class="keywordtype">void</span> *buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> adc_;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex_;
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">bool</span> stopped_;
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> readIndex_;
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> writeIndex_;
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> framesFilled_;
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 };
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a><a class="code" href="classstk_1_1RtWvIn.html#a3a4f4035fc01fee4c2423791f9e9317e">00111</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1RtWvIn.html#a3a4f4035fc01fee4c2423791f9e9317e" title="Return the specified channel value of the last computed frame.">RtWvIn :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00112"></a>00112 {
|
||||
<a name="l00113"></a>00113 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00114"></a>00114 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= data_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00115"></a>00115 oStream_ << <span class="stringliteral">"RtWvIn::lastOut(): channel argument and audio stream are incompatible!"</span>;
|
||||
<a name="l00116"></a>00116 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 <span class="preprocessor">#endif</span>
|
||||
<a name="l00119"></a>00119 <span class="preprocessor"></span>
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
77
doc/html/RtWvOut_8h_source.html
Normal file
77
doc/html/RtWvOut_8h_source.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>RtWvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_RTWVOUT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_RTWVOUT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "WvOut.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "<a class="code" href="RtAudio_8h.html">RtAudio.h</a>"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Mutex.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <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_1RtWvOut.html">00030</a> <span class="keyword">class </span><a class="code" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">RtWvOut</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</a>
|
||||
<a name="l00031"></a>00031 {
|
||||
<a name="l00032"></a>00032 <span class="keyword">public</span>:
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1RtWvOut.html#af2ee408eb10a0dbf9e14407b34f2181e" title="Default constructor.">RtWvOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, StkFloat <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">sampleRate</a> = <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>(),
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">int</span> device = 0, <span class="keywordtype">int</span> bufferFrames = RT_BUFFER_SIZE, <span class="keywordtype">int</span> nBuffers = 20 );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <a class="code" href="classstk_1_1RtWvOut.html#a85b2e30c6a153c959a33ec4aae528ca2" title="Class destructor.">~RtWvOut</a>();
|
||||
<a name="l00047"></a>00047
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1RtWvOut.html#a2e34c9ff845155230e0336ea3729dc45" title="Start the audio output stream.">start</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1RtWvOut.html#a7368c42b81670c0335b25f14faa08918" title="Stop the audio output stream.">stop</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1RtWvOut.html#a02adabdc987f3b9ac4dc4e02ea20962d" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1RtWvOut.html#a02adabdc987f3b9ac4dc4e02ea20962d" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="comment">// This function is not intended for general use but must be</span>
|
||||
<a name="l00079"></a>00079 <span class="comment">// public for access from the audio callback function.</span>
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">int</span> readBuffer( <span class="keywordtype">void</span> *buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> frameCount );
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> dac_;
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Mutex.html" title="STK mutex class.">Mutex</a> mutex_;
|
||||
<a name="l00086"></a>00086 <span class="keywordtype">bool</span> stopped_;
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> readIndex_;
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> writeIndex_;
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">long</span> framesFilled_;
|
||||
<a name="l00090"></a>00090 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> status_; <span class="comment">// running = 0, emptying buffer = 1, finished = 2</span>
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 };
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
78
doc/html/Sampler_8h_source.html
Normal file
78
doc/html/Sampler_8h_source.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Sampler.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SAMPLER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SAMPLER_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 "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.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="l00020"></a>00020 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a><a class="code" href="classstk_1_1Sampler.html">00022</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Sampler.html" title="STK sampling synthesis abstract base class.">Sampler</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00023"></a>00023 {
|
||||
<a name="l00024"></a>00024 <span class="keyword">public</span>:
|
||||
<a name="l00026"></a>00026 <a class="code" href="classstk_1_1Sampler.html#a97dbec0c39f3307560736173b4ede4e1" title="Default constructor.">Sampler</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1Sampler.html#a9262914e25d4b9fd28a760621902fd74" title="Class destructor.">~Sampler</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sampler.html#a6c80aad733f5e90dfa63d29c6a5c88ac" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sampler.html#a746eaab88793e3e8cdac9f6e59e00ca3" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency ) = 0;
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sampler.html#ad277ac455b3434eeb21d628d6c70141a" title="Initiate the envelopes with a key-on event and reset the attack waves.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sampler.html#a808aec2bf546b01e1ef53503c5a164e1" title="Signal a key-off event to the envelopes.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sampler.html#a36c3ed945fb3e8db300b7ae01a4a4a76" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sampler.html#ad9c0789f033978165226beb7c8133cc3" 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="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1Sampler.html#a08502c96fa3e5f4c853c781354ed1965" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00060"></a>00060 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Sampler.html#a08502c96fa3e5f4c853c781354ed1965" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keyword">protected</span>:
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00064"></a>00064 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00065"></a>00065 std::vector<FileWvIn *> attacks_;
|
||||
<a name="l00066"></a>00066 std::vector<FileLoop *> loops_;
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00068"></a>00068 StkFloat baseFrequency_;
|
||||
<a name="l00069"></a>00069 std::vector<StkFloat> attackRatios_;
|
||||
<a name="l00070"></a>00070 std::vector<StkFloat> loopRatios_;
|
||||
<a name="l00071"></a>00071 StkFloat attackGain_;
|
||||
<a name="l00072"></a>00072 StkFloat loopGain_;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 };
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
doc/html/Saxofony_8h_source.html
Normal file
136
doc/html/Saxofony_8h_source.html
Normal file
@@ -0,0 +1,136 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Saxofony.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SAXOFONY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SAXOFONY_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 "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "ReedTable.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00049"></a>00049 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1Saxofony.html">00051</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Saxofony.html" title="STK faux conical bore reed instrument class.">Saxofony</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00052"></a>00052 {
|
||||
<a name="l00053"></a>00053 <span class="keyword">public</span>:
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1Saxofony.html#a15984d74213308e0d81d1ee32d99ee76" title="Class constructor, taking the lowest desired playing frequency.">Saxofony</a>( StkFloat lowestFrequency );
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00061"></a>00061 <a class="code" href="classstk_1_1Saxofony.html#a1ff6a35de027e292c8a693aac314720d" title="Class destructor.">~Saxofony</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#ac74981cfa3b36ec1288eccab6aa80210" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#a5844455497f50e4b64beb23f275ac8d1" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#aeccfcfe10cef314cedf727ed5ba9d3d5" title="Set the &quot;blowing&quot; position between the air column terminations (0.0 - 1...">setBlowPosition</a>( StkFloat aPosition );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#a6e46b18ad2f992dfc3d948f966ec1bf2" title="Apply breath pressure to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#ae792c62c3bcf2fe756387c1f5cd61794" title="Decrease breath pressure with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#a924eed4733c9ecfd0e4de44f69011ea5" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#aa930437a8044fc01dc906d79a482894c" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Saxofony.html#a38efe138bea7af7aeab3652bf0a305ff" 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="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> delays_[2];
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1ReedTable.html" title="STK reed table class.">ReedTable</a> reedTable_;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 StkFloat outputGain_;
|
||||
<a name="l00110"></a>00110 StkFloat noiseGain_;
|
||||
<a name="l00111"></a>00111 StkFloat vibratoGain_;
|
||||
<a name="l00112"></a>00112 StkFloat position_;
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 };
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a><a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f">00116</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f" title="Compute and return one output sample.">Saxofony :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00117"></a>00117 {
|
||||
<a name="l00118"></a>00118 StkFloat pressureDiff;
|
||||
<a name="l00119"></a>00119 StkFloat breathPressure;
|
||||
<a name="l00120"></a>00120 StkFloat temp;
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00122"></a>00122 <span class="comment">// Calculate the breath pressure (envelope + noise + vibrato)</span>
|
||||
<a name="l00123"></a>00123 breathPressure = envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00124"></a>00124 breathPressure += breathPressure * noiseGain_ * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00125"></a>00125 breathPressure += breathPressure * vibratoGain_ * vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 temp = -0.95 * filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delays_[0].<a class="code" href="classstk_1_1Instrmnt.html#aaa6bd5e4a5be7f9b0be967daf012872e" title="Return the specified channel value of the last computed frame.">lastOut</a>() );
|
||||
<a name="l00128"></a>00128 lastFrame_[0] = temp - delays_[1].<a class="code" href="classstk_1_1DelayL.html#a16810ca38fab79276bb8ec51447623a9" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00129"></a>00129 pressureDiff = breathPressure - lastFrame_[0];
|
||||
<a name="l00130"></a>00130 delays_[1].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00131"></a>00131 delays_[0].<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( breathPressure - (pressureDiff * reedTable_.<a class="code" href="classstk_1_1ReedTable.html#a3c1607ed5712e2ab010d8c5e55e431f2" title="Take one sample input and map to one sample of output.">tick</a>(pressureDiff)) - temp );
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00133"></a>00133 lastFrame_[0] *= outputGain_;
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1Saxofony.html#a98c686337ea0c2be7683ddc569bb0a1d">00137</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f" title="Compute and return one output sample.">Saxofony :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00141"></a>00141 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00142"></a>00142 oStream_ << <span class="stringliteral">"Saxofony::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00143"></a>00143 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00144"></a>00144 }
|
||||
<a name="l00145"></a>00145 <span class="preprocessor">#endif</span>
|
||||
<a name="l00146"></a>00146 <span class="preprocessor"></span>
|
||||
<a name="l00147"></a>00147 StkFloat *samples = &frames[channel];
|
||||
<a name="l00148"></a>00148 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00150"></a>00150 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00151"></a>00151 *samples++ = <a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">else</span> {
|
||||
<a name="l00154"></a>00154 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00155"></a>00155 *samples++ = <a class="code" href="classstk_1_1Saxofony.html#a955d2ea0b3236039851d19b681ca2b0f" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00157"></a>00157 *samples++ = lastFrame_[j];
|
||||
<a name="l00158"></a>00158 }
|
||||
<a name="l00159"></a>00159 }
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00162"></a>00162 }
|
||||
<a name="l00163"></a>00163
|
||||
<a name="l00164"></a>00164 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
125
doc/html/Shakers_8h_source.html
Normal file
125
doc/html/Shakers_8h_source.html
Normal file
@@ -0,0 +1,125 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Shakers.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SHAKERS_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SHAKERS_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
|
||||
<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="l00060"></a>00060 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_FREQS = 8;
|
||||
<a name="l00063"></a>00063 <span class="keyword">const</span> <span class="keywordtype">int</span> NUM_INSTR = 24;
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a><a class="code" href="classstk_1_1Shakers.html">00065</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Shakers.html" title="PhISEM and PhOLIES class.">Shakers</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00066"></a>00066 {
|
||||
<a name="l00067"></a>00067 <span class="keyword">public</span>:
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1Shakers.html#a34e4859c572a158d8fda15b7a5c6954d" title="Class constructor.">Shakers</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1Shakers.html#aa1b2ab640268da68b867de1495f19a77" title="Class destructor.">~Shakers</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Shakers.html#a81ffb0ad1e350993af10b2795ec01861" title="Start a note with the given instrument and amplitude.">noteOn</a>( StkFloat instrument, StkFloat amplitude );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Shakers.html#ab63b4b57f8306eb7cf1adbf5a5cd1d05" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Shakers.html#a688d9d8318e0c69779868079a7c64157" 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="l00086"></a>00086
|
||||
<a name="l00088"></a>00088 StkFloat <a class="code" href="classstk_1_1Shakers.html#ae06ebba276cef74cb8c83db4e33f21c2" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Shakers.html#ae06ebba276cef74cb8c83db4e33f21c2" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">int</span> setupName( <span class="keywordtype">char</span>* instr );
|
||||
<a name="l00103"></a>00103 <span class="keywordtype">int</span> setupNum( <span class="keywordtype">int</span> inst );
|
||||
<a name="l00104"></a>00104 <span class="keywordtype">int</span> setFreqAndReson( <span class="keywordtype">int</span> which, StkFloat freq, StkFloat reson );
|
||||
<a name="l00105"></a>00105 <span class="keywordtype">void</span> setDecays( StkFloat sndDecay, StkFloat sysDecay );
|
||||
<a name="l00106"></a>00106 <span class="keywordtype">void</span> setFinalZs( StkFloat z0, StkFloat z1, StkFloat z2 );
|
||||
<a name="l00107"></a>00107 StkFloat wuter_tick( <span class="keywordtype">void</span> );
|
||||
<a name="l00108"></a>00108 StkFloat tbamb_tick( <span class="keywordtype">void</span> );
|
||||
<a name="l00109"></a>00109 StkFloat ratchet_tick( <span class="keywordtype">void</span> );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">int</span> instType_;
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">int</span> ratchetPos_, lastRatchetPos_;
|
||||
<a name="l00113"></a>00113 StkFloat shakeEnergy_;
|
||||
<a name="l00114"></a>00114 StkFloat inputs_[MAX_FREQS];
|
||||
<a name="l00115"></a>00115 StkFloat outputs_[MAX_FREQS][2];
|
||||
<a name="l00116"></a>00116 StkFloat coeffs_[MAX_FREQS][2];
|
||||
<a name="l00117"></a>00117 StkFloat sndLevel_;
|
||||
<a name="l00118"></a>00118 StkFloat baseGain_;
|
||||
<a name="l00119"></a>00119 StkFloat gains_[MAX_FREQS];
|
||||
<a name="l00120"></a>00120 <span class="keywordtype">int</span> nFreqs_;
|
||||
<a name="l00121"></a>00121 StkFloat t_center_freqs_[MAX_FREQS];
|
||||
<a name="l00122"></a>00122 StkFloat center_freqs_[MAX_FREQS];
|
||||
<a name="l00123"></a>00123 StkFloat resons_[MAX_FREQS];
|
||||
<a name="l00124"></a>00124 StkFloat freq_rand_[MAX_FREQS];
|
||||
<a name="l00125"></a>00125 <span class="keywordtype">int</span> freqalloc_[MAX_FREQS];
|
||||
<a name="l00126"></a>00126 StkFloat soundDecay_;
|
||||
<a name="l00127"></a>00127 StkFloat systemDecay_;
|
||||
<a name="l00128"></a>00128 StkFloat nObjects_;
|
||||
<a name="l00129"></a>00129 StkFloat totalEnergy_;
|
||||
<a name="l00130"></a>00130 StkFloat ratchet_, ratchetDelta_;
|
||||
<a name="l00131"></a>00131 StkFloat finalZ_[3];
|
||||
<a name="l00132"></a>00132 StkFloat finalZCoeffs_[3];
|
||||
<a name="l00133"></a>00133 StkFloat defObjs_[NUM_INSTR];
|
||||
<a name="l00134"></a>00134 StkFloat defDecays_[NUM_INSTR];
|
||||
<a name="l00135"></a>00135 StkFloat decayScale_[NUM_INSTR];
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a>00137 };
|
||||
<a name="l00138"></a>00138
|
||||
<a name="l00139"></a><a class="code" href="classstk_1_1Shakers.html#a655713b658ddeb065d755997cac4b62e">00139</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Shakers.html#ae06ebba276cef74cb8c83db4e33f21c2" title="Compute and return one output sample.">Shakers :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00140"></a>00140 {
|
||||
<a name="l00141"></a>00141 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00142"></a>00142 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00143"></a>00143 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00144"></a>00144 oStream_ << <span class="stringliteral">"Shakers::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00145"></a>00145 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
|
||||
<a name="l00148"></a>00148 <span class="preprocessor"></span>
|
||||
<a name="l00149"></a>00149 StkFloat *samples = &frames[channel];
|
||||
<a name="l00150"></a>00150 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00153"></a>00153 *samples++ = <a class="code" href="classstk_1_1Shakers.html#ae06ebba276cef74cb8c83db4e33f21c2" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155 <span class="keywordflow">else</span> {
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00157"></a>00157 *samples++ = <a class="code" href="classstk_1_1Shakers.html#ae06ebba276cef74cb8c83db4e33f21c2" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00158"></a>00158 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00159"></a>00159 *samples++ = lastFrame_[j];
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161 }
|
||||
<a name="l00162"></a>00162
|
||||
<a name="l00163"></a>00163 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00164"></a>00164 }
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00166"></a>00166 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00168"></a>00168 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
118
doc/html/Simple_8h_source.html
Normal file
118
doc/html/Simple_8h_source.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Simple.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SIMPLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SIMPLE_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 "FileLoop.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "BiQuad.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "Noise.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="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1Simple.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Simple.html" title="STK wavetable/noise instrument.">Simple</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1Simple.html#a7fae7f883b6180e7d07c9e06b62e1283" title="Class constructor.">Simple</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Simple.html#a7fc1b20b362b5902d8a47ea889144601" title="Class destructor.">~Simple</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#a8281297483ef2363a01590722dd739d8" title="Clear internal states.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#aa2dcec630c97fdafb2ba75e74194540d" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#a44650c4b65de79d4bf0b04b908c207b2" title="Start envelope toward &quot;on&quot; target.">keyOn</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#a4183bd057f8bf3783c8b1812f3459d32" title="Start envelope toward &quot;off&quot; target.">keyOff</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#aeba26edadfba0dfe0f21834bd730fdad" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#a6fbdaba299b3733b7e81ec4de5073350" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Simple.html#acd14d5368545f5650aeebbbdad65fc52" 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="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> adsr_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1FileLoop.html" title="STK file looping / oscillator class.">FileLoop</a> *loop_;
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> filter_;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> biquad_;
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00085"></a>00085 StkFloat baseFrequency_;
|
||||
<a name="l00086"></a>00086 StkFloat loopGain_;
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 };
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a><a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882">00090</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882" title="Compute and return one output sample.">Simple :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00091"></a>00091 {
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = loopGain_ * loop_-><a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00093"></a>00093 biquad_.<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="l00094"></a>00094 lastFrame_[0] += (1.0 - loopGain_) * biquad_.<a class="code" href="classstk_1_1BiQuad.html#a412f224363b1a222423ecf0cd7be9063" title="Return the last computed output value.">lastOut</a>();
|
||||
<a name="l00095"></a>00095 lastFrame_[0] = filter_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] );
|
||||
<a name="l00096"></a>00096 lastFrame_[0] *= adsr_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00097"></a>00097 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00098"></a>00098 }
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Simple.html#adff17b07913c312e989f1987e4fb5cc8">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882" title="Compute and return one output sample.">Simple :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00105"></a>00105 oStream_ << <span class="stringliteral">"Simple::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 StkFloat *samples = &frames[channel];
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">else</span> {
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00118"></a>00118 *samples++ = <a class="code" href="classstk_1_1Simple.html#aa65326847f8b693f7b5549d18df6e882" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00120"></a>00120 *samples++ = lastFrame_[j];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128
|
||||
<a name="l00129"></a>00129 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
140
doc/html/SineWave_8h_source.html
Normal file
140
doc/html/SineWave_8h_source.html
Normal file
@@ -0,0 +1,140 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>SineWave.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SINEWAVE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SINEWAVE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> TABLE_SIZE = 2048;
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Generator.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1SineWave.html">00025</a> <span class="keyword">class </span><a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00026"></a>00026 {
|
||||
<a name="l00027"></a>00027 <span class="keyword">public</span>:
|
||||
<a name="l00029"></a>00029 <a class="code" href="classstk_1_1SineWave.html#ad25afe03871430c533986b0852e04c62" title="Default constructor.">SineWave</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00032"></a>00032 <a class="code" href="classstk_1_1SineWave.html#ae192f1813531f4b2ba933bcc5b288bfb" title="Class destructor.">~SineWave</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00035"></a>00035 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SineWave.html#a667b211ead65a23aa8ab89e4a9c9ae6c" title="Clear output and reset time pointer to zero.">reset</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1SineWave.html#ae69b232dd3a33963d25cf6215692d9d5">00041</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SineWave.html#ae69b232dd3a33963d25cf6215692d9d5" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate ) { rate_ = rate; };
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SineWave.html#adc8f03d5d81cfc24c20794033aad876f" title="Increment the read pointer by time in samples, modulo the table size.">addTime</a>( StkFloat time );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SineWave.html#a62d69af61e6905ddda203756cd6e3516" title="Increment the read pointer by a normalized phase value.">addPhase</a>( StkFloat phase );
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00068"></a>00068 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SineWave.html#a87bd4c92259b9b389f568f8d7cd7524f" title="Add a normalized phase offset to the read pointer.">addPhaseOffset</a>( StkFloat phaseOffset );
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00071"></a><a class="code" href="classstk_1_1SineWave.html#ab788e787e5bb54445dd0769283567224">00071</a> StkFloat <a class="code" href="classstk_1_1SineWave.html#ab788e787e5bb54445dd0769283567224" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00074"></a>00074 StkFloat <a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00086"></a>00086 <span class="keyword">protected</span>:
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">static</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> table_;
|
||||
<a name="l00091"></a>00091 StkFloat time_;
|
||||
<a name="l00092"></a>00092 StkFloat rate_;
|
||||
<a name="l00093"></a>00093 StkFloat phaseOffset_;
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iIndex_;
|
||||
<a name="l00095"></a>00095 StkFloat alpha_;
|
||||
<a name="l00096"></a>00096
|
||||
<a name="l00097"></a>00097 };
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda">00099</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">SineWave :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="comment">// Check limits of time address ... if necessary, recalculate modulo</span>
|
||||
<a name="l00102"></a>00102 <span class="comment">// TABLE_SIZE.</span>
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">while</span> ( time_ < 0.0 )
|
||||
<a name="l00104"></a>00104 time_ += TABLE_SIZE;
|
||||
<a name="l00105"></a>00105 <span class="keywordflow">while</span> ( time_ >= TABLE_SIZE )
|
||||
<a name="l00106"></a>00106 time_ -= TABLE_SIZE;
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00108"></a>00108 iIndex_ = (<span class="keywordtype">unsigned</span> int) time_;
|
||||
<a name="l00109"></a>00109 alpha_ = time_ - iIndex_;
|
||||
<a name="l00110"></a>00110 StkFloat tmp = table_[ iIndex_ ];
|
||||
<a name="l00111"></a>00111 tmp += ( alpha_ * ( table_[ iIndex_ + 1 ] - tmp ) );
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="comment">// Increment time, which can be negative.</span>
|
||||
<a name="l00114"></a>00114 time_ += rate_;
|
||||
<a name="l00115"></a>00115
|
||||
<a name="l00116"></a>00116 lastFrame_[0] = tmp;
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1SineWave.html#af205d7029046af8a392341cabd58f9de">00120</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">SineWave :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00123"></a>00123 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00124"></a>00124 oStream_ << <span class="stringliteral">"SineWave::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00125"></a>00125 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127 <span class="preprocessor">#endif</span>
|
||||
<a name="l00128"></a>00128 <span class="preprocessor"></span>
|
||||
<a name="l00129"></a>00129 StkFloat *samples = &frames[channel];
|
||||
<a name="l00130"></a>00130 StkFloat tmp = 0.0;
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a>00132 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="comment">// Check limits of time address ... if necessary, recalculate modulo</span>
|
||||
<a name="l00136"></a>00136 <span class="comment">// TABLE_SIZE.</span>
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">while</span> ( time_ < 0.0 )
|
||||
<a name="l00138"></a>00138 time_ += TABLE_SIZE;
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">while</span> ( time_ >= TABLE_SIZE )
|
||||
<a name="l00140"></a>00140 time_ -= TABLE_SIZE;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 iIndex_ = (<span class="keywordtype">unsigned</span> int) time_;
|
||||
<a name="l00143"></a>00143 alpha_ = time_ - iIndex_;
|
||||
<a name="l00144"></a>00144 tmp = table_[ iIndex_ ];
|
||||
<a name="l00145"></a>00145 tmp += ( alpha_ * ( table_[ iIndex_ + 1 ] - tmp ) );
|
||||
<a name="l00146"></a>00146 *samples = tmp;
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00148"></a>00148 <span class="comment">// Increment time, which can be negative.</span>
|
||||
<a name="l00149"></a>00149 time_ += rate_;
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 lastFrame_[0] = tmp;
|
||||
<a name="l00153"></a>00153 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00157"></a>00157
|
||||
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
|
||||
<a name="l00159"></a>00159 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
119
doc/html/SingWave_8h_source.html
Normal file
119
doc/html/SingWave_8h_source.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>SingWave.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SINGWAVE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SINGWAVE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "FileLoop.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Modulate.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00007"></a>00007
|
||||
<a name="l00008"></a>00008 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00010"></a>00010 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00025"></a><a class="code" href="classstk_1_1SingWave.html">00025</a> <span class="keyword">class </span><a class="code" href="classstk_1_1SingWave.html" title="STK &quot;singing&quot; looped soundfile class.">SingWave</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a>
|
||||
<a name="l00026"></a>00026 {
|
||||
<a name="l00027"></a>00027 <span class="keyword">public</span>:
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1SingWave.html#a7a38283d4e42d5f9b96d3ce8c401183a" title="Class constructor taking filename argument.">SingWave</a>( std::string fileName, <span class="keywordtype">bool</span> raw = <span class="keyword">false</span> );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1SingWave.html#a0cd0c9dc6878705b638098c425ced782" title="Class destructor.">~SingWave</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1SingWave.html#a906a50d64292988d48aa742c80e4f572">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#a906a50d64292988d48aa742c80e4f572" title="Reset file to beginning.">reset</a>( <span class="keywordtype">void</span> ) { wave_.<a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">reset</a>(); lastFrame_[0] = 0.0; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1SingWave.html#aed07d9ebe8289abe232eb1337d0708db">00045</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#aed07d9ebe8289abe232eb1337d0708db" title="Normalize the file to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { wave_.<a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>(); };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1SingWave.html#aeece74c720cfe97c3d7f67c01a102b3d">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#aeece74c720cfe97c3d7f67c01a102b3d" title="Normalize the file to a maximum of +- peak.">normalize</a>( StkFloat peak ) { wave_.<a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( peak ); };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#ae1ac4a84551f89570ff0842d032a3cba" title="Set looping parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1SingWave.html#a9143162e223ad86682c099d2a6c79ea0">00054</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#a9143162e223ad86682c099d2a6c79ea0" title="Set the vibrato frequency in Hz.">setVibratoRate</a>( StkFloat rate ) { modulator_.<a class="code" href="classstk_1_1Modulate.html#a298b25f4b7cc56f2dffae5474a05999d" title="Set the periodic (vibrato) rate or frequency in Hz.">setVibratoRate</a>( rate ); };
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a><a class="code" href="classstk_1_1SingWave.html#a5276e1e244551d1ca1dcc70ed42e9228">00057</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#a5276e1e244551d1ca1dcc70ed42e9228" title="Set the vibrato gain.">setVibratoGain</a>( StkFloat gain ) { modulator_.<a class="code" href="classstk_1_1Modulate.html#a08f2d489a3fba3a10d1f301aed869ed4" title="Set the periodic (vibrato) gain.">setVibratoGain</a>( gain ); };
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1SingWave.html#a287cf0feecb7eda88328fb2bc0edff92">00060</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#a287cf0feecb7eda88328fb2bc0edff92" title="Set the random-ness amount.">setRandomGain</a>( StkFloat gain ) { modulator_.<a class="code" href="classstk_1_1Modulate.html#ac6e7a02378facf59916f2460ed5c2fa5" title="Set the random modulation gain.">setRandomGain</a>( gain ); };
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1SingWave.html#ab80c50b3c8fc05f056221452504aa150">00063</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#ab80c50b3c8fc05f056221452504aa150" title="Set the sweep rate.">setSweepRate</a>( StkFloat rate ) { sweepRate_ = rate; };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1SingWave.html#a7e2a4183704bea50f9d793bd998d6554">00066</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#a7e2a4183704bea50f9d793bd998d6554" title="Set the gain rate.">setGainRate</a>( StkFloat rate ) { envelope_.<a class="code" href="classstk_1_1Envelope.html#ade99b5c7cb974f71f1d2919868d774a0" title="Set the rate.">setRate</a>( rate ); };
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a><a class="code" href="classstk_1_1SingWave.html#ac248b298dd095bd7c9ed2c84a229a55f">00069</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#ac248b298dd095bd7c9ed2c84a229a55f" title="Set the gain target value.">setGainTarget</a>( StkFloat target ) { envelope_.<a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>( target ); };
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1SingWave.html#a9bd638590605e5b5eb679467506e42ff">00072</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#a9bd638590605e5b5eb679467506e42ff" title="Start a note.">noteOn</a>( <span class="keywordtype">void</span> ) { envelope_.<a class="code" href="classstk_1_1Envelope.html#a18cf8f21ef70227bd5cd17f53752bd0f" title="Set target = 1.">keyOn</a>(); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1SingWave.html#ac81240ee79f64b90a9c37d45c0aa3a7f">00075</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1SingWave.html#ac81240ee79f64b90a9c37d45c0aa3a7f" title="Stop a note.">noteOff</a>( <span class="keywordtype">void</span> ) { envelope_.<a class="code" href="classstk_1_1Envelope.html#a9dbefb15f8d64aac3969f77d38791774" title="Set target = 0.">keyOff</a>(); };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a><a class="code" href="classstk_1_1SingWave.html#af1c5286c4a58904241d7b73ff29d4be0">00078</a> StkFloat <a class="code" href="classstk_1_1SingWave.html#af1c5286c4a58904241d7b73ff29d4be0" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 StkFloat <a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keyword">protected</span>:
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1FileLoop.html" title="STK file looping / oscillator class.">FileLoop</a> wave_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1Modulate.html" title="STK periodic/random modulator.">Modulate</a> modulator_;
|
||||
<a name="l00097"></a>00097 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> pitchEnvelope_;
|
||||
<a name="l00099"></a>00099 StkFloat rate_;
|
||||
<a name="l00100"></a>00100 StkFloat sweepRate_;
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 };
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a><a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78">00104</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78" title="Compute and return one output sample.">SingWave :: tick</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00105"></a>00105 {
|
||||
<a name="l00106"></a>00106 <span class="comment">// Set the wave rate.</span>
|
||||
<a name="l00107"></a>00107 StkFloat newRate = pitchEnvelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00108"></a>00108 newRate += newRate * modulator_.<a class="code" href="classstk_1_1Modulate.html#a237b96dd553d65253abbf00a186e293d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00109"></a>00109 wave_.<a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( newRate );
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 lastFrame_[0] = wave_.<a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" title="Compute a sample frame and return the specified channel value.">tick</a>();
|
||||
<a name="l00112"></a>00112 lastFrame_[0] *= envelope_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a><a class="code" href="classstk_1_1SingWave.html#ab74d7a305510eec92a9aa1a26bcb5e94">00117</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78" title="Compute and return one output sample.">SingWave :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00118"></a>00118 {
|
||||
<a name="l00119"></a>00119 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00120"></a>00120 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00121"></a>00121 oStream_ << <span class="stringliteral">"SingWave::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00122"></a>00122 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124 <span class="preprocessor">#endif</span>
|
||||
<a name="l00125"></a>00125 <span class="preprocessor"></span>
|
||||
<a name="l00126"></a>00126 StkFloat *samples = &frames[channel];
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00128"></a>00128 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00129"></a>00129 *samples = <a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78" title="Compute and return one output sample.">SingWave::tick</a>();
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00135"></a>00135
|
||||
<a name="l00136"></a>00136 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
122
doc/html/Sitar_8h_source.html
Normal file
122
doc/html/Sitar_8h_source.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Sitar.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SITAR_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SITAR_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 "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "ADSR.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include <cmath></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="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1Sitar.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Sitar.html" title="STK sitar string model class.">Sitar</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036 <a class="code" href="classstk_1_1Sitar.html#a8a2c996ad8b32f98f2bca14aa742bc29" title="Class constructor, taking the lowest desired playing frequency.">Sitar</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1Sitar.html#a4bb1d8cd5c1ffc331e6c97e28f6f3000" title="Class destructor.">~Sitar</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sitar.html#a52cc4d38204e6825e524228008a0e94c" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sitar.html#a02acfe592d8d601a37fadb94aaedb074" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sitar.html#afcbccba0e49bf538c190381785c90752" title="Pluck the string with the given amplitude using the current frequency.">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sitar.html#a02fb8c574a4ea9acd4ae7f3f3636b3b3" 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 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sitar.html#ae4acf7cf5f8319fa3420133c2802e9f6" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 StkFloat <a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00067"></a>00067 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <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_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00072"></a>00072 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> loopFilter_;
|
||||
<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 <a class="code" href="classstk_1_1ADSR.html" title="STK ADSR envelope class.">ADSR</a> envelope_;
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 StkFloat loopGain_;
|
||||
<a name="l00077"></a>00077 StkFloat amGain_;
|
||||
<a name="l00078"></a>00078 StkFloat delay_;
|
||||
<a name="l00079"></a>00079 StkFloat targetDelay_;
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00081"></a>00081 };
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00083"></a><a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e">00083</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e" title="Compute and return one output sample.">Sitar :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00084"></a>00084 {
|
||||
<a name="l00085"></a>00085 <span class="keywordflow">if</span> ( fabs(targetDelay_ - delay_) > 0.001 ) {
|
||||
<a name="l00086"></a>00086 <span class="keywordflow">if</span> ( targetDelay_ < delay_ )
|
||||
<a name="l00087"></a>00087 delay_ *= 0.99999;
|
||||
<a name="l00088"></a>00088 <span class="keywordflow">else</span>
|
||||
<a name="l00089"></a>00089 delay_ *= 1.00001;
|
||||
<a name="l00090"></a>00090 delayLine_.<a class="code" href="classstk_1_1DelayA.html#a83ddc9bdf2f5059159160fdac0e25eda" title="Set the delay-line length.">setDelay</a>( delay_ );
|
||||
<a name="l00091"></a>00091 }
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( loopFilter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_ ) +
|
||||
<a name="l00094"></a>00094 (amGain_ * envelope_.<a class="code" href="classstk_1_1ADSR.html#af2c0869f86210a55f4f668172373c975" title="Compute and return one output sample.">tick</a>() * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>()));
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Sitar.html#a755cc36fe9cde1942184af0b1ae88f7a">00099</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e" title="Compute and return one output sample.">Sitar :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <span class="stringliteral">"Sitar::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00113"></a>00113 *samples++ = <a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00114"></a>00114 }
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">else</span> {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00117"></a>00117 *samples++ = <a class="code" href="classstk_1_1Sitar.html#a811c8d08d78cfbd5061396af7027043e" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00119"></a>00119 *samples++ = lastFrame_[j];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#endif</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
101
doc/html/Skini_8h_source.html
Normal file
101
doc/html/Skini_8h_source.html
Normal file
@@ -0,0 +1,101 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Skini.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SKINI_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SKINI_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include <fstream></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="l00036"></a>00036 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00038"></a><a class="code" href="classstk_1_1Skini.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Skini.html" title="STK SKINI parsing class.">Skini</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a><a class="code" href="structstk_1_1Skini_1_1Message.html">00043</a> <span class="keyword">struct </span><a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Message</a> {
|
||||
<a name="l00044"></a><a class="code" href="structstk_1_1Skini_1_1Message.html#a6f55441cfdbc674c992fd98f95d458ca">00044</a> <span class="keywordtype">long</span> <a class="code" href="structstk_1_1Skini_1_1Message.html#a6f55441cfdbc674c992fd98f95d458ca">type</a>;
|
||||
<a name="l00045"></a><a class="code" href="structstk_1_1Skini_1_1Message.html#ac5d1504e617c2227055799300fc1936e">00045</a> <span class="keywordtype">long</span> <a class="code" href="structstk_1_1Skini_1_1Message.html#ac5d1504e617c2227055799300fc1936e">channel</a>;
|
||||
<a name="l00046"></a><a class="code" href="structstk_1_1Skini_1_1Message.html#a6d07933c0cf4c92e76677236c2341e2f">00046</a> StkFloat <a class="code" href="structstk_1_1Skini_1_1Message.html#a6d07933c0cf4c92e76677236c2341e2f">time</a>;
|
||||
<a name="l00047"></a><a class="code" href="structstk_1_1Skini_1_1Message.html#acb4bb30558903d1b02092207d4f2dda8">00047</a> std::vector<StkFloat> <a class="code" href="structstk_1_1Skini_1_1Message.html#acb4bb30558903d1b02092207d4f2dda8">floatValues</a>;
|
||||
<a name="l00048"></a><a class="code" href="structstk_1_1Skini_1_1Message.html#a0d5d310534fa8a7edc43ca259e73ffc7">00048</a> std::vector<long> <a class="code" href="structstk_1_1Skini_1_1Message.html#a0d5d310534fa8a7edc43ca259e73ffc7">intValues</a>;
|
||||
<a name="l00049"></a><a class="code" href="structstk_1_1Skini_1_1Message.html#a8c61b471a341e0168eb475b458404247">00049</a> std::string <a class="code" href="structstk_1_1Skini_1_1Message.html#a8c61b471a341e0168eb475b458404247">remainder</a>;
|
||||
<a name="l00051"></a>00051 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00052"></a>00052 <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Message</a>()
|
||||
<a name="l00053"></a>00053 :<a class="code" href="structstk_1_1Skini_1_1Message.html#a6f55441cfdbc674c992fd98f95d458ca">type</a>(0), <a class="code" href="structstk_1_1Skini_1_1Message.html#ac5d1504e617c2227055799300fc1936e">channel</a>(0), <a class="code" href="structstk_1_1Skini_1_1Message.html#a6d07933c0cf4c92e76677236c2341e2f">time</a>(0.0), <a class="code" href="structstk_1_1Skini_1_1Message.html#acb4bb30558903d1b02092207d4f2dda8">floatValues</a>(2), <a class="code" href="structstk_1_1Skini_1_1Message.html#a0d5d310534fa8a7edc43ca259e73ffc7">intValues</a>(2) {}
|
||||
<a name="l00054"></a>00054 };
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <a class="code" href="classstk_1_1Skini.html#aed904de40a0fa1d22dbb08bc4517f4c8" title="Default constructor.">Skini</a>();
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <a class="code" href="classstk_1_1Skini.html#a7c960798afad4b53065ebb26ff00495a" title="Class destructor.">~Skini</a>();
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Skini.html#a30eb5f5238c552d042b8eb510aa8d241" title="Set a SKINI formatted file for reading.">setFile</a>( std::string fileName );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Skini.html#a675f2a9841c4b84e161de651eed4412d" title="Parse the next file message (if a file is loaded) and return the message type.">nextMessage</a>( <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Skini.html#ad3e29f6ca88052e95698137ec2e545ad" title="Attempt to parse the given string and returning the message type.">parseString</a>( std::string& line, <a class="code" href="structstk_1_1Skini_1_1Message.html" title="A message structure to store and pass parsed SKINI messages.">Skini::Message</a>& message );
|
||||
<a name="l00084"></a>00084
|
||||
<a name="l00086"></a>00086 <span class="keyword">static</span> std::string <a class="code" href="classstk_1_1Skini.html#afae7977e19f7b7f647ee2c6ade62a199" title="Return the SKINI type string for the given type value.">whatsThisType</a>(<span class="keywordtype">long</span> type);
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00089"></a>00089 <span class="keyword">static</span> std::string <a class="code" href="classstk_1_1Skini.html#a30c34ff9ffd7646165155fa4d62dee6c" title="Return the SKINI controller string for the given controller number.">whatsThisController</a>(<span class="keywordtype">long</span> number);
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keywordtype">void</span> tokenize( <span class="keyword">const</span> std::string& str, std::vector<std::string>& tokens, <span class="keyword">const</span> std::string& delimiters );
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 std::ifstream file_;
|
||||
<a name="l00096"></a>00096 };
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00099"></a>00099 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> Midi2Pitch[129] = {
|
||||
<a name="l00100"></a>00100 8.176, 8.662, 9.177, 9.723, 10.301, 10.913, 11.562, 12.25,
|
||||
<a name="l00101"></a>00101 12.978, 13.75, 14.568, 15.434, 16.352, 17.324, 18.354, 19.445,
|
||||
<a name="l00102"></a>00102 20.602, 21.827, 23.125, 24.50, 25.957, 27.50, 29.135, 30.868,
|
||||
<a name="l00103"></a>00103 32.703, 34.648, 36.708, 38.891, 41.203, 43.654, 46.249, 49.0,
|
||||
<a name="l00104"></a>00104 51.913, 55.0, 58.271, 61.735, 65.406, 69.296, 73.416, 77.782,
|
||||
<a name="l00105"></a>00105 82.407, 87.307, 92.499, 97.999, 103.826, 110.0, 116.541, 123.471,
|
||||
<a name="l00106"></a>00106 130.813, 138.591, 146.832, 155.563, 164.814, 174.614, 184.997, 195.998,
|
||||
<a name="l00107"></a>00107 207.652, 220.0, 233.082, 246.942, 261.626, 277.183, 293.665, 311.127,
|
||||
<a name="l00108"></a>00108 329.628, 349.228, 369.994, 391.995, 415.305, 440.0, 466.164, 493.883,
|
||||
<a name="l00109"></a>00109 523.251, 554.365, 587.33, 622.254, 659.255, 698.456, 739.989, 783.991,
|
||||
<a name="l00110"></a>00110 830.609, 880.0, 932.328, 987.767, 1046.502, 1108.731, 1174.659, 1244.508,
|
||||
<a name="l00111"></a>00111 1318.51, 1396.913, 1479.978, 1567.982, 1661.219, 1760.0, 1864.655, 1975.533,
|
||||
<a name="l00112"></a>00112 2093.005, 2217.461, 2349.318, 2489.016, 2637.02, 2793.826, 2959.955, 3135.963,
|
||||
<a name="l00113"></a>00113 3322.438, 3520.0, 3729.31, 3951.066, 4186.009, 4434.922, 4698.636, 4978.032,
|
||||
<a name="l00114"></a>00114 5274.041, 5587.652, 5919.911, 6271.927, 6644.875, 7040.0, 7458.62, 7902.133,
|
||||
<a name="l00115"></a>00115 8372.018, 8869.844, 9397.273, 9956.063, 10548.082, 11175.303, 11839.822, 12543.854,
|
||||
<a name="l00116"></a>00116 13289.75};
|
||||
<a name="l00117"></a>00117
|
||||
<a name="l00118"></a>00118 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="preprocessor">#endif</span>
|
||||
<a name="l00121"></a>00121 <span class="preprocessor"></span>
|
||||
<a name="l00122"></a>00122
|
||||
</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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
92
doc/html/Socket_8h_source.html
Normal file
92
doc/html/Socket_8h_source.html
Normal file
@@ -0,0 +1,92 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Socket.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SOCKET_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SOCKET_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor"> #include <sys/socket.h></span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"> #include <sys/types.h></span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor"> #include <arpa/inet.h></span>
|
||||
<a name="l00011"></a>00011 <span class="preprocessor"> #include <netdb.h></span>
|
||||
<a name="l00012"></a>00012 <span class="preprocessor"> #include <unistd.h></span>
|
||||
<a name="l00013"></a>00013 <span class="preprocessor"> #include <fcntl.h></span>
|
||||
<a name="l00014"></a>00014 <span class="preprocessor"> #include <netinet/in.h></span>
|
||||
<a name="l00015"></a>00015 <span class="preprocessor"> #include <netinet/tcp.h></span>
|
||||
<a name="l00016"></a>00016
|
||||
<a name="l00017"></a>00017 <span class="preprocessor">#elif defined(__OS_WINDOWS__)</span>
|
||||
<a name="l00018"></a>00018 <span class="preprocessor"></span>
|
||||
<a name="l00019"></a>00019 <span class="preprocessor"> #include <winsock.h></span>
|
||||
<a name="l00020"></a>00020
|
||||
<a name="l00021"></a>00021 <span class="preprocessor">#endif</span>
|
||||
<a name="l00022"></a>00022 <span class="preprocessor"></span>
|
||||
<a name="l00023"></a>00023 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00024"></a>00024
|
||||
<a name="l00025"></a>00025 <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_1Socket.html">00038</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00039"></a>00039 {
|
||||
<a name="l00040"></a>00040 <span class="keyword">public</span>:
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00042"></a>00042 <span class="keyword">enum</span> ProtocolType {
|
||||
<a name="l00043"></a>00043 PROTO_TCP,
|
||||
<a name="l00044"></a>00044 PROTO_UDP
|
||||
<a name="l00045"></a>00045 };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1Socket.html#a2558d3b2001c07eeae9d3e301df399fe" title="Class constructor.">Socket</a>();
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1Socket.html#a8fb79fcfba5d1438575e0fb933f8b37b" title="Class destructor.">~Socket</a>();
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Socket.html#a816c3dfae2549db692944042821d6019" title="Close the socket.">close</a>( <span class="keywordtype">int</span> socket );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a><a class="code" href="classstk_1_1Socket.html#aeae0c6721248eecd5dae0b77ea66cb2c">00057</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#aeae0c6721248eecd5dae0b77ea66cb2c" title="Return the socket descriptor.">id</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> soket_; };
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7">00060</a> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> port_; };
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1Socket.html#a61375099d0d0811bf79c894587cc3724">00063</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Socket.html#a61375099d0d0811bf79c894587cc3724" title="Returns true if the socket descriptor is valid.">isValid</a>( <span class="keywordtype">int</span> socket ) { <span class="keywordflow">return</span> socket != -1; };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Socket.html#a12f0abb799fbf7d5d2ee6364627cb6ac" title="If enable = false, the socket is set to non-blocking mode. When first created, sockets...">setBlocking</a>( <span class="keywordtype">int</span> socket, <span class="keywordtype">bool</span> enable );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#a7938202181552306d0ea74c6c04abf4a" title="Write a buffer over the socket connection. Returns the number of bytes written or...">writeBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0) = 0;
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#aa99d0f4e1c0ebae768a9f3f124364906" title="Read an input buffer, up to length bufferSize. Returns the number of bytes read or...">readBuffer</a>(<span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0) = 0;
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#a7938202181552306d0ea74c6c04abf4a" title="Write a buffer over the socket connection. Returns the number of bytes written or...">writeBuffer</a>(<span class="keywordtype">int</span> socket, <span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags );
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#aa99d0f4e1c0ebae768a9f3f124364906" title="Read an input buffer, up to length bufferSize. Returns the number of bytes read or...">readBuffer</a>(<span class="keywordtype">int</span> socket, <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <span class="keyword">protected</span>:
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">int</span> soket_;
|
||||
<a name="l00083"></a>00083 <span class="keywordtype">int</span> port_;
|
||||
<a name="l00084"></a>00084
|
||||
<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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
82
doc/html/Sphere_8h_source.html
Normal file
82
doc/html/Sphere_8h_source.html
Normal file
@@ -0,0 +1,82 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Sphere.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_SPHERE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_SPHERE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "Vector3D.h"</span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1Sphere.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Sphere.html" title="STK sphere class.">Sphere</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Sphere.html#a73d4fac54fba9aa11a56a34e4198656c">00024</a> <a class="code" href="classstk_1_1Sphere.html#a73d4fac54fba9aa11a56a34e4198656c" title="Constructor taking an initial radius value.">Sphere</a>( StkFloat radius = 1.0 ) { radius_ = radius; mass_ = 1.0; };
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1Sphere.html#acfa3d4475f9c5ab655276473b1816f39">00027</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#acfa3d4475f9c5ab655276473b1816f39" title="Set the 3D center position of the sphere.">setPosition</a>( StkFloat x, StkFloat y, StkFloat z ) { position_.<a class="code" href="classstk_1_1Vector3D.html#a65fd03de6d9d42ea53a6cb8418ee7149" title="Set the X, Y, and Z values simultaniously.">setXYZ</a>(x, y, z); };
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Sphere.html#ac76725a19fe806e9af9841d30faacb11">00030</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#ac76725a19fe806e9af9841d30faacb11" title="Set the 3D velocity of the sphere.">setVelocity</a>( StkFloat x, StkFloat y, StkFloat z ) { velocity_.<a class="code" href="classstk_1_1Vector3D.html#a65fd03de6d9d42ea53a6cb8418ee7149" title="Set the X, Y, and Z values simultaniously.">setXYZ</a>(x, y, z); };
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Sphere.html#ac3f4f85642307bebe0733662620f0ee2">00033</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#ac3f4f85642307bebe0733662620f0ee2" title="Set the radius of the sphere.">setRadius</a>( StkFloat radius ) { radius_ = radius; };
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1Sphere.html#a0db842c9f06b377bcd803391b7126d2f">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#a0db842c9f06b377bcd803391b7126d2f" title="Set the mass of the sphere.">setMass</a>( StkFloat mass ) { mass_ = mass; };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Sphere.html#a91a3e710a7ff0cf160e9d46fca373bfd">00039</a> <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a>* <a class="code" href="classstk_1_1Sphere.html#a91a3e710a7ff0cf160e9d46fca373bfd" title="Get the current position of the sphere as a 3D vector.">getPosition</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> &position_; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a>* <a class="code" href="classstk_1_1Sphere.html#a4cf8f763e732bcf9ca79b8602e8ec24a" title="Get the relative position of the given point to the sphere as a 3D vector.">getRelativePosition</a>( <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> *position );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 StkFloat <a class="code" href="classstk_1_1Sphere.html#a43ccf47d5d952f14f1ba0940aa87f4c5" title="Set the velcoity of the sphere as a 3D vector.">getVelocity</a>( <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a>* velocity );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 StkFloat <a class="code" href="classstk_1_1Sphere.html#a00bf47b0d5cd06a858d08f37d220ef9f" title="Returns the distance from the sphere boundary to the given position (&lt; 0 if inside)...">isInside</a>( <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> *position );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a><a class="code" href="classstk_1_1Sphere.html#a03550bbe32d62ead67787651619b8c8b">00051</a> StkFloat <a class="code" href="classstk_1_1Sphere.html#a03550bbe32d62ead67787651619b8c8b" title="Get the current sphere radius.">getRadius</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> radius_; };
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a><a class="code" href="classstk_1_1Sphere.html#aa82d922e0b8513364d9d0d473e6239c6">00054</a> StkFloat <a class="code" href="classstk_1_1Sphere.html#aa82d922e0b8513364d9d0d473e6239c6" title="Get the current sphere mass.">getMass</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> mass_; };
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#a16666f1e94c6d1e6b1fa35ee6c46331f" title="Increase the current sphere velocity by the given 3D components.">addVelocity</a>( StkFloat x, StkFloat y, StkFloat z );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#adc4709622b77fc91ad6f33be98c86344" title="Move the sphere for the given time increment.">tick</a>( StkFloat timeIncrement );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00062"></a>00062 <span class="keyword">private</span>:
|
||||
<a name="l00063"></a>00063 <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> position_;
|
||||
<a name="l00064"></a>00064 <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> velocity_;
|
||||
<a name="l00065"></a>00065 <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> workingVector_;
|
||||
<a name="l00066"></a>00066 StkFloat radius_;
|
||||
<a name="l00067"></a>00067 StkFloat mass_;
|
||||
<a name="l00068"></a>00068 };
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a><a class="code" href="classstk_1_1Sphere.html#adc4709622b77fc91ad6f33be98c86344">00070</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Sphere.html#adc4709622b77fc91ad6f33be98c86344" title="Move the sphere for the given time increment.">Sphere::tick</a>( StkFloat timeIncrement )
|
||||
<a name="l00071"></a>00071 {
|
||||
<a name="l00072"></a>00072 position_.<a class="code" href="classstk_1_1Vector3D.html#a9825ba3adb8fb272d2e3ca20740a48c5" title="Set the X value.">setX</a>(position_.<a class="code" href="classstk_1_1Vector3D.html#ae4f7cddc34ed1cf80262ff2d5dad65f4" title="Get the current X value.">getX</a>() + (timeIncrement * velocity_.<a class="code" href="classstk_1_1Vector3D.html#ae4f7cddc34ed1cf80262ff2d5dad65f4" title="Get the current X value.">getX</a>()));
|
||||
<a name="l00073"></a>00073 position_.<a class="code" href="classstk_1_1Vector3D.html#a94de5326b083c6cf72f509aa0fc532f3" title="Set the Y value.">setY</a>(position_.<a class="code" href="classstk_1_1Vector3D.html#af83bfbe865d702845e37e14d82f642b6" title="Get the current Y value.">getY</a>() + (timeIncrement * velocity_.<a class="code" href="classstk_1_1Vector3D.html#af83bfbe865d702845e37e14d82f642b6" title="Get the current Y value.">getY</a>()));
|
||||
<a name="l00074"></a>00074 position_.<a class="code" href="classstk_1_1Vector3D.html#a826f2aa5e7b95a0d91f9432f26bec881" title="Set the Z value.">setZ</a>(position_.<a class="code" href="classstk_1_1Vector3D.html#af1c7389a2b4640cbe594fa33f9e4f805" title="Get the current Z value.">getZ</a>() + (timeIncrement * velocity_.<a class="code" href="classstk_1_1Vector3D.html#af1c7389a2b4640cbe594fa33f9e4f805" title="Get the current Z value.">getZ</a>()));
|
||||
<a name="l00075"></a>00075 };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00077"></a>00077 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
135
doc/html/StifKarp_8h_source.html
Normal file
135
doc/html/StifKarp_8h_source.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>StifKarp.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_STIFKARP_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_STIFKARP_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 "DelayL.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "DelayA.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "BiQuad.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="l00034"></a>00034 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1StifKarp.html">00036</a> <span class="keyword">class </span><a class="code" href="classstk_1_1StifKarp.html" title="STK plucked stiff string instrument.">StifKarp</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00037"></a>00037 {
|
||||
<a name="l00038"></a>00038 <span class="keyword">public</span>:
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1StifKarp.html#a2ac1b3641559e787cf78a017797e9a70" title="Class constructor, taking the lowest desired playing frequency.">StifKarp</a>( StkFloat lowestFrequency = 8.0 );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1StifKarp.html#a37bc5b0bb4fe385eda862622f675bee1" title="Class destructor.">~StifKarp</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#ad1015fa6d2ac1835d8be7dec0df12f6f" title="Reset and clear all internal state.">clear</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_1StifKarp.html#a51371b8592fc01aba1993ac304962f6e" 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_1StifKarp.html#a21a9b7407c9d6a0b2ba34c0e41bb0b57" title="Set the stretch &quot;factor&quot; of the string (0.0 - 1.0).">setStretch</a>( StkFloat stretch );
|
||||
<a name="l00053"></a>00053
|
||||
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#a55ca9e1f3c205e4fb51e6d4a7393db70" title="Set the pluck or &quot;excitation&quot; position along the string (0.0 - 1.0).">setPickupPosition</a>( StkFloat position );
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#ad1b5de5acf487271d99903cd43e891ce" title="Set the base loop gain.">setBaseLoopGain</a>( StkFloat aGain );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#a016ff5971a1b51ea472f7e7fa2d677ee" title="Pluck the string with the given amplitude using the current frequency.">pluck</a>( StkFloat amplitude );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#ae2831958f1dd782ccf34c4068c2b7f14" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a>00072 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#a1806fb5c05fa5abdcd3ddb4c97d8ea78" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a>00075 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StifKarp.html#a27e76ba187140ae575c1bd2e1ba99b03" 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="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 StkFloat <a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00093"></a>00093 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> combDelay_;
|
||||
<a name="l00094"></a>00094 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> filter_;
|
||||
<a name="l00095"></a>00095 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00096"></a>00096 <a class="code" href="classstk_1_1BiQuad.html" title="STK biquad (two-pole, two-zero) filter class.">BiQuad</a> biquad_[4];
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> length_;
|
||||
<a name="l00099"></a>00099 StkFloat loopGain_;
|
||||
<a name="l00100"></a>00100 StkFloat baseLoopGain_;
|
||||
<a name="l00101"></a>00101 StkFloat lastFrequency_;
|
||||
<a name="l00102"></a>00102 StkFloat lastLength_;
|
||||
<a name="l00103"></a>00103 StkFloat stretching_;
|
||||
<a name="l00104"></a>00104 StkFloat pluckAmplitude_;
|
||||
<a name="l00105"></a>00105 StkFloat pickupPosition_;
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 };
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a><a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc">00109</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">StifKarp :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00110"></a>00110 {
|
||||
<a name="l00111"></a>00111 StkFloat temp = delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() * loopGain_;
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 <span class="comment">// Calculate allpass stretching.</span>
|
||||
<a name="l00114"></a>00114 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<4; i++)
|
||||
<a name="l00115"></a>00115 temp = biquad_[i].<a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">tick</a>(temp);
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="comment">// Moving average filter.</span>
|
||||
<a name="l00118"></a>00118 temp = filter_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00121"></a>00121 lastFrame_[0] = lastFrame_[0] - combDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] );
|
||||
<a name="l00122"></a>00122 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00123"></a>00123 }
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a><a class="code" href="classstk_1_1StifKarp.html#a7d4afff257faa7ad9ef630f1db1ed93f">00125</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">StifKarp :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00126"></a>00126 {
|
||||
<a name="l00127"></a>00127 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00128"></a>00128 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00129"></a>00129 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00130"></a>00130 oStream_ << <span class="stringliteral">"StifKarp::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00131"></a>00131 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00132"></a>00132 }
|
||||
<a name="l00133"></a>00133 <span class="preprocessor">#endif</span>
|
||||
<a name="l00134"></a>00134 <span class="preprocessor"></span>
|
||||
<a name="l00135"></a>00135 StkFloat *samples = &frames[channel];
|
||||
<a name="l00136"></a>00136 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00137"></a>00137 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00138"></a>00138 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00139"></a>00139 *samples++ = <a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00140"></a>00140 }
|
||||
<a name="l00141"></a>00141 <span class="keywordflow">else</span> {
|
||||
<a name="l00142"></a>00142 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00143"></a>00143 *samples++ = <a class="code" href="classstk_1_1StifKarp.html#a5cd896c59ee01fa8e21346ebe54365fc" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00145"></a>00145 *samples++ = lastFrame_[j];
|
||||
<a name="l00146"></a>00146 }
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00150"></a>00150 }
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
371
doc/html/Stk_8h_source.html
Normal file
371
doc/html/Stk_8h_source.html
Normal file
@@ -0,0 +1,371 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Stk.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_STK_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_STK_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include <string></span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <iostream></span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include <sstream></span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include <vector></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include <cstdlib></span>
|
||||
<a name="l00009"></a>00009
|
||||
<a name="l00016"></a>00016 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00017"></a>00017
|
||||
<a name="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00068"></a>00068 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 <span class="comment">//#define _STK_DEBUG_</span>
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 <span class="comment">// Most data in STK is passed and calculated with the</span>
|
||||
<a name="l00073"></a>00073 <span class="comment">// following user-definable floating-point type. You</span>
|
||||
<a name="l00074"></a>00074 <span class="comment">// can change this to "float" if you prefer or perhaps</span>
|
||||
<a name="l00075"></a>00075 <span class="comment">// a "long double" in the future.</span>
|
||||
<a name="l00076"></a>00076 <span class="keyword">typedef</span> <span class="keywordtype">double</span> StkFloat;
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1StkError.html">00084</a> <span class="keyword">class </span><a class="code" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a>
|
||||
<a name="l00085"></a>00085 {
|
||||
<a name="l00086"></a>00086 <span class="keyword">public</span>:
|
||||
<a name="l00087"></a>00087 <span class="keyword">enum</span> Type {
|
||||
<a name="l00088"></a>00088 STATUS,
|
||||
<a name="l00089"></a>00089 WARNING,
|
||||
<a name="l00090"></a>00090 DEBUG_PRINT,
|
||||
<a name="l00091"></a>00091 MEMORY_ALLOCATION,
|
||||
<a name="l00092"></a>00092 MEMORY_ACCESS,
|
||||
<a name="l00093"></a>00093 FUNCTION_ARGUMENT,
|
||||
<a name="l00094"></a>00094 FILE_NOT_FOUND,
|
||||
<a name="l00095"></a>00095 FILE_UNKNOWN_FORMAT,
|
||||
<a name="l00096"></a>00096 FILE_ERROR,
|
||||
<a name="l00097"></a>00097 PROCESS_THREAD,
|
||||
<a name="l00098"></a>00098 PROCESS_SOCKET,
|
||||
<a name="l00099"></a>00099 PROCESS_SOCKET_IPADDR,
|
||||
<a name="l00100"></a>00100 AUDIO_SYSTEM,
|
||||
<a name="l00101"></a>00101 MIDI_SYSTEM,
|
||||
<a name="l00102"></a>00102 UNSPECIFIED
|
||||
<a name="l00103"></a>00103 };
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00105"></a>00105 <span class="keyword">protected</span>:
|
||||
<a name="l00106"></a>00106 std::string message_;
|
||||
<a name="l00107"></a>00107 Type type_;
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keyword">public</span>:
|
||||
<a name="l00111"></a><a class="code" href="classstk_1_1StkError.html#ab6cbc80df11b385b20d244327fb74abb">00111</a> <a class="code" href="classstk_1_1StkError.html#ab6cbc80df11b385b20d244327fb74abb" title="The constructor.">StkError</a>(<span class="keyword">const</span> std::string& message, Type type = StkError::UNSPECIFIED)
|
||||
<a name="l00112"></a>00112 : message_(message), type_(type) {}
|
||||
<a name="l00113"></a>00113
|
||||
<a name="l00115"></a><a class="code" href="classstk_1_1StkError.html#ab0639b3a9354a0f84a9338d1c9b87464">00115</a> <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkError.html#ab0639b3a9354a0f84a9338d1c9b87464" title="The destructor.">~StkError</a>(<span class="keywordtype">void</span>) {};
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00118"></a><a class="code" href="classstk_1_1StkError.html#a337437a729f03d48fc56277037ac6fdc">00118</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkError.html#a337437a729f03d48fc56277037ac6fdc" title="Prints thrown error message to stderr.">printMessage</a>(<span class="keywordtype">void</span>) { std::cerr << <span class="charliteral">'\n'</span> << message_ << <span class="stringliteral">"\n\n"</span>; }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00121"></a><a class="code" href="classstk_1_1StkError.html#aae641cf5ed2b756adbf02fc668fac53e">00121</a> <span class="keyword">virtual</span> <span class="keyword">const</span> Type& <a class="code" href="classstk_1_1StkError.html#aae641cf5ed2b756adbf02fc668fac53e" title="Returns the thrown error message type.">getType</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> type_; }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1StkError.html#ac691cbffe442d9e0760978146df5d9fb">00124</a> <span class="keyword">virtual</span> <span class="keyword">const</span> std::string& <a class="code" href="classstk_1_1StkError.html#ac691cbffe442d9e0760978146df5d9fb" title="Returns the thrown error message string.">getMessage</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> message_; }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1StkError.html#ae802643199c86a797f7adebe109d84bf">00127</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classstk_1_1StkError.html#ae802643199c86a797f7adebe109d84bf" title="Returns the thrown error message as a C string.">getMessageCString</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> message_.c_str(); }
|
||||
<a name="l00128"></a>00128 };
|
||||
<a name="l00129"></a>00129
|
||||
<a name="l00130"></a>00130
|
||||
<a name="l00131"></a><a class="code" href="classstk_1_1Stk.html">00131</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00132"></a>00132 {
|
||||
<a name="l00133"></a>00133 <span class="keyword">public</span>:
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00135"></a>00135 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> StkFormat;
|
||||
<a name="l00136"></a><a class="code" href="classstk_1_1Stk.html#adec863631653693af8f1ed5c0cfc5c4c">00136</a> <span class="keyword">static</span> <span class="keyword">const</span> StkFormat <a class="code" href="classstk_1_1Stk.html#adec863631653693af8f1ed5c0cfc5c4c">STK_SINT8</a>;
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">00137</a> <span class="keyword">static</span> <span class="keyword">const</span> StkFormat <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>;
|
||||
<a name="l00138"></a><a class="code" href="classstk_1_1Stk.html#afbe8049756ea88bdd8cebad65305dd52">00138</a> <span class="keyword">static</span> <span class="keyword">const</span> StkFormat <a class="code" href="classstk_1_1Stk.html#afbe8049756ea88bdd8cebad65305dd52">STK_SINT24</a>;
|
||||
<a name="l00139"></a><a class="code" href="classstk_1_1Stk.html#a605c96894e1b0f1f08a80214a08012ad">00139</a> <span class="keyword">static</span> <span class="keyword">const</span> StkFormat <a class="code" href="classstk_1_1Stk.html#a605c96894e1b0f1f08a80214a08012ad">STK_SINT32</a>;
|
||||
<a name="l00140"></a><a class="code" href="classstk_1_1Stk.html#a079e62be7093d593498e9d2ba4ac20fa">00140</a> <span class="keyword">static</span> <span class="keyword">const</span> StkFormat <a class="code" href="classstk_1_1Stk.html#a079e62be7093d593498e9d2ba4ac20fa">STK_FLOAT32</a>;
|
||||
<a name="l00141"></a><a class="code" href="classstk_1_1Stk.html#a57b00150ae559b6f099be117b2e53af4">00141</a> <span class="keyword">static</span> <span class="keyword">const</span> StkFormat <a class="code" href="classstk_1_1Stk.html#a57b00150ae559b6f099be117b2e53af4">STK_FLOAT64</a>;
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a><a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d">00144</a> <span class="keyword">static</span> StkFloat <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">sampleRate</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> srate_; }
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00147"></a>00147
|
||||
<a name="l00164"></a>00164 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a46e2f55e5a92c717c3893fe23dde88a5" title="Static method that sets the STK sample rate.">setSampleRate</a>( StkFloat rate );
|
||||
<a name="l00165"></a>00165
|
||||
<a name="l00167"></a>00167
|
||||
<a name="l00172"></a><a class="code" href="classstk_1_1Stk.html#ab8a52e4897bea5c0f5e66adf37a8e39b">00172</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#ab8a52e4897bea5c0f5e66adf37a8e39b" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00173"></a>00173
|
||||
<a name="l00175"></a><a class="code" href="classstk_1_1Stk.html#a5f3fd05b709788213549fe2cbaf4a52a">00175</a> <span class="keyword">static</span> std::string <a class="code" href="classstk_1_1Stk.html#a5f3fd05b709788213549fe2cbaf4a52a" title="Static method that returns the current rawwave path.">rawwavePath</a>(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> rawwavepath_; }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00178"></a>00178 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a4f641ad194f9d8ce1f9d1ae56af5686b" title="Static method that sets the STK rawwave path.">setRawwavePath</a>( std::string path );
|
||||
<a name="l00179"></a>00179
|
||||
<a name="l00181"></a>00181 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#ab2dc4c9e67317eb0753868a89c8095f6" title="Static method that byte-swaps a 16-bit data type.">swap16</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *ptr );
|
||||
<a name="l00182"></a>00182
|
||||
<a name="l00184"></a>00184 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a820631139e6f7e23d328d387c0f530fd" title="Static method that byte-swaps a 32-bit data type.">swap32</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *ptr );
|
||||
<a name="l00185"></a>00185
|
||||
<a name="l00187"></a>00187 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a5f744eadf29ecbfbeddfdf7ceb5853c9" title="Static method that byte-swaps a 64-bit data type.">swap64</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *ptr );
|
||||
<a name="l00188"></a>00188
|
||||
<a name="l00190"></a>00190 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#ad75619ab92a0c19b5a52cb68884511e3" title="Static cross-platform method to sleep for a number of milliseconds.">sleep</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> milliseconds );
|
||||
<a name="l00191"></a>00191
|
||||
<a name="l00193"></a><a class="code" href="classstk_1_1Stk.html#a7dd617f6bf20e55d3ab97b86d8200b2e">00193</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Stk.html#a7dd617f6bf20e55d3ab97b86d8200b2e" title="Static method to check whether a value is within a specified range.">inRange</a>( StkFloat value, StkFloat min, StkFloat max ) {
|
||||
<a name="l00194"></a>00194 <span class="keywordflow">if</span> ( value < min ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00195"></a>00195 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( value > max ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00196"></a>00196 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00197"></a>00197 }
|
||||
<a name="l00198"></a>00198
|
||||
<a name="l00200"></a>00200 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *message, StkError::Type type );
|
||||
<a name="l00201"></a>00201
|
||||
<a name="l00203"></a>00203 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( std::string message, StkError::Type type );
|
||||
<a name="l00204"></a>00204
|
||||
<a name="l00206"></a><a class="code" href="classstk_1_1Stk.html#a2d8b38b9f808fb7c5e65c228b4b7dbbb">00206</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a2d8b38b9f808fb7c5e65c228b4b7dbbb" title="Toggle display of WARNING and STATUS messages.">showWarnings</a>( <span class="keywordtype">bool</span> status ) { showWarnings_ = status; }
|
||||
<a name="l00207"></a>00207
|
||||
<a name="l00209"></a><a class="code" href="classstk_1_1Stk.html#affb98f8f1f65ddc9e4af8440056b1504">00209</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#affb98f8f1f65ddc9e4af8440056b1504" title="Toggle display of error messages before throwing exceptions.">printErrors</a>( <span class="keywordtype">bool</span> status ) { printErrors_ = status; }
|
||||
<a name="l00210"></a>00210
|
||||
<a name="l00211"></a>00211 <span class="keyword">private</span>:
|
||||
<a name="l00212"></a>00212 <span class="keyword">static</span> StkFloat srate_;
|
||||
<a name="l00213"></a>00213 <span class="keyword">static</span> std::string rawwavepath_;
|
||||
<a name="l00214"></a>00214 <span class="keyword">static</span> <span class="keywordtype">bool</span> showWarnings_;
|
||||
<a name="l00215"></a>00215 <span class="keyword">static</span> <span class="keywordtype">bool</span> printErrors_;
|
||||
<a name="l00216"></a>00216 <span class="keyword">static</span> std::vector<Stk *> alertList_;
|
||||
<a name="l00217"></a>00217
|
||||
<a name="l00218"></a>00218 <span class="keyword">protected</span>:
|
||||
<a name="l00219"></a>00219
|
||||
<a name="l00220"></a>00220 <span class="keyword">static</span> std::ostringstream oStream_;
|
||||
<a name="l00221"></a>00221 <span class="keywordtype">bool</span> ignoreSampleRateChange_;
|
||||
<a name="l00222"></a>00222
|
||||
<a name="l00224"></a>00224 <a class="code" href="classstk_1_1Stk.html#a9bff83b5a318ff171f94a218ad52226b" title="Default constructor.">Stk</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00225"></a>00225
|
||||
<a name="l00227"></a>00227 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1Stk.html#ad0d5c6ab745ad2841a59032addae3905" title="Class destructor.">~Stk</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00228"></a>00228
|
||||
<a name="l00230"></a>00230 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a740e872daa4b2ad1c918163e7c5ab56b" title="This function should be implemented in subclasses that depend on the sample rate...">sampleRateChanged</a>( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00231"></a>00231
|
||||
<a name="l00233"></a>00233 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a5ab0e88856708f65887295ad4ad90340" title="Add class pointer to list for sample rate change notification.">addSampleRateAlert</a>( <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a> *ptr );
|
||||
<a name="l00234"></a>00234
|
||||
<a name="l00236"></a>00236 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a349865986f712f58087cb72603a6ced8" title="Remove class pointer from list for sample rate change notification.">removeSampleRateAlert</a>( <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a> *ptr );
|
||||
<a name="l00237"></a>00237
|
||||
<a name="l00239"></a>00239 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::Type type );
|
||||
<a name="l00240"></a>00240 };
|
||||
<a name="l00241"></a>00241
|
||||
<a name="l00242"></a>00242
|
||||
<a name="l00243"></a>00243 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00269"></a>00269 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00270"></a>00270
|
||||
<a name="l00271"></a><a class="code" href="classstk_1_1StkFrames.html">00271</a> <span class="keyword">class </span><a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>
|
||||
<a name="l00272"></a>00272 {
|
||||
<a name="l00273"></a>00273 <span class="keyword">public</span>:
|
||||
<a name="l00274"></a>00274
|
||||
<a name="l00276"></a>00276 <a class="code" href="classstk_1_1StkFrames.html#aa9ad14889de633ba4269f1330be8bedf" title="The default constructor initializes the frame data structure to size zero.">StkFrames</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 0 );
|
||||
<a name="l00277"></a>00277
|
||||
<a name="l00279"></a>00279 <a class="code" href="classstk_1_1StkFrames.html#aa9ad14889de633ba4269f1330be8bedf" title="The default constructor initializes the frame data structure to size zero.">StkFrames</a>( <span class="keyword">const</span> StkFloat& value, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels );
|
||||
<a name="l00280"></a>00280
|
||||
<a name="l00282"></a>00282 <a class="code" href="classstk_1_1StkFrames.html#a3fa9a0a175de2b18e75d9b68a6387895" title="The destructor.">~StkFrames</a>();
|
||||
<a name="l00283"></a>00283
|
||||
<a name="l00284"></a>00284 <span class="comment">// A copy constructor.</span>
|
||||
<a name="l00285"></a>00285 <a class="code" href="classstk_1_1StkFrames.html#aa9ad14889de633ba4269f1330be8bedf" title="The default constructor initializes the frame data structure to size zero.">StkFrames</a>( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& f );
|
||||
<a name="l00286"></a>00286
|
||||
<a name="l00287"></a>00287 <span class="comment">// Assignment operator that returns a reference to self.</span>
|
||||
<a name="l00288"></a>00288 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& operator= ( <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& f );
|
||||
<a name="l00289"></a>00289
|
||||
<a name="l00291"></a>00291
|
||||
<a name="l00297"></a>00297 StkFloat& <a class="code" href="classstk_1_1StkFrames.html#a8ed9cc0a4309f786cfe36da9e901fde9" title="Subscript operator that returns a reference to element n of self.">operator[] </a>( <span class="keywordtype">size_t</span> n );
|
||||
<a name="l00298"></a>00298
|
||||
<a name="l00300"></a>00300
|
||||
<a name="l00304"></a>00304 StkFloat <a class="code" href="classstk_1_1StkFrames.html#a8ed9cc0a4309f786cfe36da9e901fde9" title="Subscript operator that returns a reference to element n of self.">operator[] </a>( <span class="keywordtype">size_t</span> n ) <span class="keyword">const</span>;
|
||||
<a name="l00305"></a>00305
|
||||
<a name="l00307"></a>00307
|
||||
<a name="l00312"></a>00312 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#a0f6a81d36a8905d782b283b9a05893e6" title="Assignment by sum operator into self.">operator+= </a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& f );
|
||||
<a name="l00313"></a>00313
|
||||
<a name="l00315"></a>00315
|
||||
<a name="l00320"></a>00320 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#a049cbfd10908f754a7c48c1dd0da21e0" title="Assignment by product operator into self.">operator*= </a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& f );
|
||||
<a name="l00321"></a>00321
|
||||
<a name="l00323"></a>00323
|
||||
<a name="l00330"></a>00330 StkFloat& <a class="code" href="classstk_1_1StkFrames.html#a813632277bf0c432bcf81136ccdbbec1" title="Channel / frame subscript operator that returns a reference.">operator() </a>( <span class="keywordtype">size_t</span> frame, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel );
|
||||
<a name="l00331"></a>00331
|
||||
<a name="l00333"></a>00333
|
||||
<a name="l00338"></a>00338 StkFloat <a class="code" href="classstk_1_1StkFrames.html#a813632277bf0c432bcf81136ccdbbec1" title="Channel / frame subscript operator that returns a reference.">operator() </a>( <span class="keywordtype">size_t</span> frame, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel ) <span class="keyword">const</span>;
|
||||
<a name="l00339"></a>00339
|
||||
<a name="l00341"></a>00341
|
||||
<a name="l00347"></a>00347 StkFloat <a class="code" href="classstk_1_1StkFrames.html#a4f9402d9be28da418f630b4261b9b386" title="Return an interpolated value at the fractional frame index and channel.">interpolate</a>( StkFloat frame, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) <span class="keyword">const</span>;
|
||||
<a name="l00348"></a>00348
|
||||
<a name="l00350"></a><a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79">00350</a> <span class="keywordtype">size_t</span> <a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> size_; };
|
||||
<a name="l00351"></a>00351
|
||||
<a name="l00353"></a>00353 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1StkFrames.html#ac6652950830fe907f9158ee891560253" title="Returns true if the object size is zero and false otherwise.">empty</a>() <span class="keyword">const</span>;
|
||||
<a name="l00354"></a>00354
|
||||
<a name="l00356"></a>00356
|
||||
<a name="l00363"></a>00363 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( <span class="keywordtype">size_t</span> nFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1 );
|
||||
<a name="l00364"></a>00364
|
||||
<a name="l00366"></a>00366
|
||||
<a name="l00373"></a>00373 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe" title="Resize self to represent the specified number of channels and frames.">resize</a>( <span class="keywordtype">size_t</span> nFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels, StkFloat value );
|
||||
<a name="l00374"></a>00374
|
||||
<a name="l00376"></a><a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870">00376</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nChannels_; };
|
||||
<a name="l00377"></a>00377
|
||||
<a name="l00379"></a><a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9">00379</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> nFrames_; };
|
||||
<a name="l00380"></a>00380
|
||||
<a name="l00382"></a>00382
|
||||
<a name="l00386"></a><a class="code" href="classstk_1_1StkFrames.html#ad528b1c8ea2866570e7d9c2bac0e8b40">00386</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#ad528b1c8ea2866570e7d9c2bac0e8b40" title="Set the sample rate associated with the StkFrames data.">setDataRate</a>( StkFloat rate ) { dataRate_ = rate; };
|
||||
<a name="l00387"></a>00387
|
||||
<a name="l00389"></a>00389
|
||||
<a name="l00393"></a><a class="code" href="classstk_1_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522">00393</a> StkFloat <a class="code" href="classstk_1_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> dataRate_; };
|
||||
<a name="l00394"></a>00394
|
||||
<a name="l00395"></a>00395 <span class="keyword">private</span>:
|
||||
<a name="l00396"></a>00396
|
||||
<a name="l00397"></a>00397 StkFloat *data_;
|
||||
<a name="l00398"></a>00398 StkFloat dataRate_;
|
||||
<a name="l00399"></a>00399 <span class="keywordtype">size_t</span> nFrames_;
|
||||
<a name="l00400"></a>00400 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels_;
|
||||
<a name="l00401"></a>00401 <span class="keywordtype">size_t</span> size_;
|
||||
<a name="l00402"></a>00402 <span class="keywordtype">size_t</span> bufferSize_;
|
||||
<a name="l00403"></a>00403
|
||||
<a name="l00404"></a>00404 };
|
||||
<a name="l00405"></a>00405
|
||||
<a name="l00406"></a><a class="code" href="classstk_1_1StkFrames.html#ac6652950830fe907f9158ee891560253">00406</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1StkFrames.html#ac6652950830fe907f9158ee891560253" title="Returns true if the object size is zero and false otherwise.">StkFrames :: empty</a>()<span class="keyword"> const</span>
|
||||
<a name="l00407"></a>00407 <span class="keyword"></span>{
|
||||
<a name="l00408"></a>00408 <span class="keywordflow">if</span> ( size_ > 0 ) <span class="keywordflow">return</span> <span class="keyword">false</span>;
|
||||
<a name="l00409"></a>00409 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;
|
||||
<a name="l00410"></a>00410 }
|
||||
<a name="l00411"></a>00411
|
||||
<a name="l00412"></a><a class="code" href="classstk_1_1StkFrames.html#a8ed9cc0a4309f786cfe36da9e901fde9">00412</a> <span class="keyword">inline</span> StkFloat& <a class="code" href="classstk_1_1StkFrames.html#a8ed9cc0a4309f786cfe36da9e901fde9" title="Subscript operator that returns a reference to element n of self.">StkFrames :: operator[] </a>( <span class="keywordtype">size_t</span> n )
|
||||
<a name="l00413"></a>00413 {
|
||||
<a name="l00414"></a>00414 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00415"></a>00415 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( n >= size_ ) {
|
||||
<a name="l00416"></a>00416 std::ostringstream error;
|
||||
<a name="l00417"></a>00417 error << <span class="stringliteral">"StkFrames::operator[]: invalid index ("</span> << n << <span class="stringliteral">") value!"</span>;
|
||||
<a name="l00418"></a>00418 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
|
||||
<a name="l00419"></a>00419 }
|
||||
<a name="l00420"></a>00420 <span class="preprocessor">#endif</span>
|
||||
<a name="l00421"></a>00421 <span class="preprocessor"></span>
|
||||
<a name="l00422"></a>00422 <span class="keywordflow">return</span> data_[n];
|
||||
<a name="l00423"></a>00423 }
|
||||
<a name="l00424"></a>00424
|
||||
<a name="l00425"></a><a class="code" href="classstk_1_1StkFrames.html#a2d1c8a2b32725ca72e0f3256f9cd8cb6">00425</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1StkFrames.html#a8ed9cc0a4309f786cfe36da9e901fde9" title="Subscript operator that returns a reference to element n of self.">StkFrames :: operator[] </a>( <span class="keywordtype">size_t</span> n )<span class="keyword"> const</span>
|
||||
<a name="l00426"></a>00426 <span class="keyword"></span>{
|
||||
<a name="l00427"></a>00427 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00428"></a>00428 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( n >= size_ ) {
|
||||
<a name="l00429"></a>00429 std::ostringstream error;
|
||||
<a name="l00430"></a>00430 error << <span class="stringliteral">"StkFrames::operator[]: invalid index ("</span> << n << <span class="stringliteral">") value!"</span>;
|
||||
<a name="l00431"></a>00431 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
|
||||
<a name="l00432"></a>00432 }
|
||||
<a name="l00433"></a>00433 <span class="preprocessor">#endif</span>
|
||||
<a name="l00434"></a>00434 <span class="preprocessor"></span>
|
||||
<a name="l00435"></a>00435 <span class="keywordflow">return</span> data_[n];
|
||||
<a name="l00436"></a>00436 }
|
||||
<a name="l00437"></a>00437
|
||||
<a name="l00438"></a><a class="code" href="classstk_1_1StkFrames.html#a813632277bf0c432bcf81136ccdbbec1">00438</a> <span class="keyword">inline</span> StkFloat& <a class="code" href="classstk_1_1StkFrames.html#a813632277bf0c432bcf81136ccdbbec1" title="Channel / frame subscript operator that returns a reference.">StkFrames :: operator() </a>( <span class="keywordtype">size_t</span> frame, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00439"></a>00439 {
|
||||
<a name="l00440"></a>00440 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00441"></a>00441 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( frame >= nFrames_ || channel >= nChannels_ ) {
|
||||
<a name="l00442"></a>00442 std::ostringstream error;
|
||||
<a name="l00443"></a>00443 error << <span class="stringliteral">"StkFrames::operator(): invalid frame ("</span> << frame << <span class="stringliteral">") or channel ("</span> << channel << <span class="stringliteral">") value!"</span>;
|
||||
<a name="l00444"></a>00444 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
|
||||
<a name="l00445"></a>00445 }
|
||||
<a name="l00446"></a>00446 <span class="preprocessor">#endif</span>
|
||||
<a name="l00447"></a>00447 <span class="preprocessor"></span>
|
||||
<a name="l00448"></a>00448 <span class="keywordflow">return</span> data_[ frame * nChannels_ + channel ];
|
||||
<a name="l00449"></a>00449 }
|
||||
<a name="l00450"></a>00450
|
||||
<a name="l00451"></a><a class="code" href="classstk_1_1StkFrames.html#a93e7e4c30affc29d0cdc98e7514188de">00451</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1StkFrames.html#a813632277bf0c432bcf81136ccdbbec1" title="Channel / frame subscript operator that returns a reference.">StkFrames :: operator() </a>( <span class="keywordtype">size_t</span> frame, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )<span class="keyword"> const</span>
|
||||
<a name="l00452"></a>00452 <span class="keyword"></span>{
|
||||
<a name="l00453"></a>00453 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00454"></a>00454 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( frame >= nFrames_ || channel >= nChannels_ ) {
|
||||
<a name="l00455"></a>00455 std::ostringstream error;
|
||||
<a name="l00456"></a>00456 error << <span class="stringliteral">"StkFrames::operator(): invalid frame ("</span> << frame << <span class="stringliteral">") or channel ("</span> << channel << <span class="stringliteral">") value!"</span>;
|
||||
<a name="l00457"></a>00457 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
|
||||
<a name="l00458"></a>00458 }
|
||||
<a name="l00459"></a>00459 <span class="preprocessor">#endif</span>
|
||||
<a name="l00460"></a>00460 <span class="preprocessor"></span>
|
||||
<a name="l00461"></a>00461 <span class="keywordflow">return</span> data_[ frame * nChannels_ + channel ];
|
||||
<a name="l00462"></a>00462 }
|
||||
<a name="l00463"></a>00463
|
||||
<a name="l00464"></a><a class="code" href="classstk_1_1StkFrames.html#a0f6a81d36a8905d782b283b9a05893e6">00464</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#a0f6a81d36a8905d782b283b9a05893e6" title="Assignment by sum operator into self.">StkFrames :: operator+= </a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& f )
|
||||
<a name="l00465"></a>00465 {
|
||||
<a name="l00466"></a>00466 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00467"></a>00467 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( f.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>() != nFrames_ || f.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() != nChannels_ ) {
|
||||
<a name="l00468"></a>00468 std::ostringstream error;
|
||||
<a name="l00469"></a>00469 error << <span class="stringliteral">"StkFrames::operator+=: frames argument must be of equal dimensions!"</span>;
|
||||
<a name="l00470"></a>00470 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
|
||||
<a name="l00471"></a>00471 }
|
||||
<a name="l00472"></a>00472 <span class="preprocessor">#endif</span>
|
||||
<a name="l00473"></a>00473 <span class="preprocessor"></span>
|
||||
<a name="l00474"></a>00474 StkFloat *fptr = &f[0];
|
||||
<a name="l00475"></a>00475 StkFloat *dptr = data_;
|
||||
<a name="l00476"></a>00476 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<size_; i++ )
|
||||
<a name="l00477"></a>00477 *dptr++ += *fptr++;
|
||||
<a name="l00478"></a>00478 }
|
||||
<a name="l00479"></a>00479
|
||||
<a name="l00480"></a><a class="code" href="classstk_1_1StkFrames.html#a049cbfd10908f754a7c48c1dd0da21e0">00480</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1StkFrames.html#a049cbfd10908f754a7c48c1dd0da21e0" title="Assignment by product operator into self.">StkFrames :: operator*= </a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& f )
|
||||
<a name="l00481"></a>00481 {
|
||||
<a name="l00482"></a>00482 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00483"></a>00483 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( f.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>() != nFrames_ || f.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() != nChannels_ ) {
|
||||
<a name="l00484"></a>00484 std::ostringstream error;
|
||||
<a name="l00485"></a>00485 error << <span class="stringliteral">"StkFrames::operator*=: frames argument must be of equal dimensions!"</span>;
|
||||
<a name="l00486"></a>00486 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
|
||||
<a name="l00487"></a>00487 }
|
||||
<a name="l00488"></a>00488 <span class="preprocessor">#endif</span>
|
||||
<a name="l00489"></a>00489 <span class="preprocessor"></span>
|
||||
<a name="l00490"></a>00490 StkFloat *fptr = &f[0];
|
||||
<a name="l00491"></a>00491 StkFloat *dptr = data_;
|
||||
<a name="l00492"></a>00492 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<size_; i++ )
|
||||
<a name="l00493"></a>00493 *dptr++ *= *fptr++;
|
||||
<a name="l00494"></a>00494 }
|
||||
<a name="l00495"></a>00495
|
||||
<a name="l00496"></a>00496 <span class="comment">// Here are a few other useful typedefs.</span>
|
||||
<a name="l00497"></a>00497 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> UINT16;
|
||||
<a name="l00498"></a>00498 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> UINT32;
|
||||
<a name="l00499"></a>00499 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">short</span> SINT16;
|
||||
<a name="l00500"></a>00500 <span class="keyword">typedef</span> <span class="keywordtype">signed</span> <span class="keywordtype">int</span> SINT32;
|
||||
<a name="l00501"></a>00501 <span class="keyword">typedef</span> <span class="keywordtype">float</span> FLOAT32;
|
||||
<a name="l00502"></a>00502 <span class="keyword">typedef</span> <span class="keywordtype">double</span> FLOAT64;
|
||||
<a name="l00503"></a>00503
|
||||
<a name="l00504"></a>00504 <span class="comment">// The default sampling rate.</span>
|
||||
<a name="l00505"></a>00505 <span class="keyword">const</span> StkFloat SRATE = 44100.0;
|
||||
<a name="l00506"></a>00506
|
||||
<a name="l00507"></a>00507 <span class="comment">// The default real-time audio input and output buffer size. If</span>
|
||||
<a name="l00508"></a>00508 <span class="comment">// clicks are occuring in the input and/or output sound stream, a</span>
|
||||
<a name="l00509"></a>00509 <span class="comment">// larger buffer size may help. Larger buffer sizes, however, produce</span>
|
||||
<a name="l00510"></a>00510 <span class="comment">// more latency.</span>
|
||||
<a name="l00511"></a>00511 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> RT_BUFFER_SIZE = 512;
|
||||
<a name="l00512"></a>00512
|
||||
<a name="l00513"></a>00513 <span class="comment">// The default rawwave path value is set with the preprocessor</span>
|
||||
<a name="l00514"></a>00514 <span class="comment">// definition RAWWAVE_PATH. This can be specified as an argument to</span>
|
||||
<a name="l00515"></a>00515 <span class="comment">// the configure script, in an integrated development environment, or</span>
|
||||
<a name="l00516"></a>00516 <span class="comment">// below. The global STK rawwave path variable can be dynamically set</span>
|
||||
<a name="l00517"></a>00517 <span class="comment">// with the Stk::setRawwavePath() function. This value is</span>
|
||||
<a name="l00518"></a>00518 <span class="comment">// concatenated to the beginning of all references to rawwave files in</span>
|
||||
<a name="l00519"></a>00519 <span class="comment">// the various STK core classes (ex. Clarinet.cpp). If you wish to</span>
|
||||
<a name="l00520"></a>00520 <span class="comment">// move the rawwaves directory to a different location in your file</span>
|
||||
<a name="l00521"></a>00521 <span class="comment">// system, you will need to set this path definition appropriately.</span>
|
||||
<a name="l00522"></a>00522 <span class="preprocessor">#if !defined(RAWWAVE_PATH)</span>
|
||||
<a name="l00523"></a>00523 <span class="preprocessor"></span><span class="preprocessor"> #define RAWWAVE_PATH "../../rawwaves/"</span>
|
||||
<a name="l00524"></a>00524 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
||||
<a name="l00525"></a>00525 <span class="preprocessor"></span>
|
||||
<a name="l00526"></a>00526 <span class="keyword">const</span> StkFloat PI = 3.14159265358979;
|
||||
<a name="l00527"></a>00527 <span class="keyword">const</span> StkFloat TWO_PI = 2 * PI;
|
||||
<a name="l00528"></a>00528 <span class="keyword">const</span> StkFloat ONE_OVER_128 = 0.0078125;
|
||||
<a name="l00529"></a>00529
|
||||
<a name="l00530"></a>00530 <span class="preprocessor">#if defined(__WINDOWS_DS__) || defined(__WINDOWS_ASIO__) || defined(__WINDOWS_MM__)</span>
|
||||
<a name="l00531"></a>00531 <span class="preprocessor"></span><span class="preprocessor"> #define __OS_WINDOWS__</span>
|
||||
<a name="l00532"></a>00532 <span class="preprocessor"></span><span class="preprocessor"> #define __STK_REALTIME__</span>
|
||||
<a name="l00533"></a>00533 <span class="preprocessor"></span><span class="preprocessor">#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__) || defined(__UNIX_JACK__)</span>
|
||||
<a name="l00534"></a>00534 <span class="preprocessor"></span><span class="preprocessor"> #define __OS_LINUX__</span>
|
||||
<a name="l00535"></a>00535 <span class="preprocessor"></span><span class="preprocessor"> #define __STK_REALTIME__</span>
|
||||
<a name="l00536"></a>00536 <span class="preprocessor"></span><span class="preprocessor">#elif defined(__IRIX_AL__)</span>
|
||||
<a name="l00537"></a>00537 <span class="preprocessor"></span><span class="preprocessor"> #define __OS_IRIX__</span>
|
||||
<a name="l00538"></a>00538 <span class="preprocessor"></span><span class="preprocessor">#elif defined(__MACOSX_CORE__) || defined(__UNIX_JACK__)</span>
|
||||
<a name="l00539"></a>00539 <span class="preprocessor"></span><span class="preprocessor"> #define __OS_MACOSX__</span>
|
||||
<a name="l00540"></a>00540 <span class="preprocessor"></span><span class="preprocessor"> #define __STK_REALTIME__</span>
|
||||
<a name="l00541"></a>00541 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
||||
<a name="l00542"></a>00542 <span class="preprocessor"></span>
|
||||
<a name="l00543"></a>00543 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00544"></a>00544
|
||||
<a name="l00545"></a>00545 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
173
doc/html/TapDelay_8h_source.html
Normal file
173
doc/html/TapDelay_8h_source.html
Normal file
@@ -0,0 +1,173 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>TapDelay.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TAPDELAY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TAPDELAY_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00022"></a>00022 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1TapDelay.html">00024</a> <span class="keyword">class </span><a class="code" href="classstk_1_1TapDelay.html" title="STK non-interpolating tapped delay line class.">TapDelay</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00025"></a>00025 {
|
||||
<a name="l00026"></a>00026 <span class="keyword">public</span>:
|
||||
<a name="l00027"></a>00027
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00034"></a>00034 <a class="code" href="classstk_1_1TapDelay.html#a24913411dff23e05995979e42cc51ecc" title="The default constructor creates a delay-line with maximum length of 4095 samples...">TapDelay</a>( std::vector<unsigned long> taps = std::vector<unsigned long>( 1, 0 ), <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxDelay = 4095 );
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a>00037 <a class="code" href="classstk_1_1TapDelay.html#a6980be10c3d3cb9633af1733b40e49cc" title="Class destructor.">~TapDelay</a>();
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TapDelay.html#a104b7bd81435a38191e1e43a24cb471d" title="Set the maximum delay-line length.">setMaximumDelay</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> delay );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TapDelay.html#aa2bbab19ae277dc3689471d4250f00ad" title="Set the delay-line tap lengths.">setTapDelays</a>( std::vector<unsigned long> taps );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1TapDelay.html#aad3736becdec6059f2986f873d69b971">00056</a> std::vector<unsigned long> <a class="code" href="classstk_1_1TapDelay.html#aad3736becdec6059f2986f873d69b971" title="Return the current delay-line length.">getTapDelays</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> delays_; };
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1TapDelay.html#a517399ddf52455ef083481cbb77c0b5c" title="Return the specified tap value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> tap = 0 ) <span class="keyword">const</span>;
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00079"></a>00079 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b" title="Input one sample to the delayline and return outputs at all tap positions.">tick</a>( StkFloat input, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& outputs );
|
||||
<a name="l00080"></a>00080
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00091"></a>00091 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b" title="Input one sample to the delayline and return outputs at all tap positions.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b" title="Input one sample to the delayline and return outputs at all tap positions.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0 );
|
||||
<a name="l00106"></a>00106
|
||||
<a name="l00107"></a>00107 <span class="keyword">protected</span>:
|
||||
<a name="l00108"></a>00108
|
||||
<a name="l00109"></a>00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> inPoint_;
|
||||
<a name="l00110"></a>00110 std::vector<unsigned long> outPoint_;
|
||||
<a name="l00111"></a>00111 std::vector<unsigned long> delays_;
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a>00113 };
|
||||
<a name="l00114"></a>00114
|
||||
<a name="l00115"></a><a class="code" href="classstk_1_1TapDelay.html#a517399ddf52455ef083481cbb77c0b5c">00115</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1TapDelay.html#a517399ddf52455ef083481cbb77c0b5c" title="Return the specified tap value of the last computed frame.">TapDelay :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> tap )<span class="keyword"> const</span>
|
||||
<a name="l00116"></a>00116 <span class="keyword"></span>{
|
||||
<a name="l00117"></a>00117 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00118"></a>00118 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( tap >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) ) {
|
||||
<a name="l00119"></a>00119 oStream_ << <span class="stringliteral">"TapDelay::lastOut(): tap argument and number of taps are incompatible!"</span>;
|
||||
<a name="l00120"></a>00120 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 <span class="preprocessor">#endif</span>
|
||||
<a name="l00123"></a>00123 <span class="preprocessor"></span>
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> lastFrame_[tap];
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a><a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b">00127</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b" title="Input one sample to the delayline and return outputs at all tap positions.">TapDelay :: tick</a>( StkFloat input, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& outputs )
|
||||
<a name="l00128"></a>00128 {
|
||||
<a name="l00129"></a>00129 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00130"></a>00130 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( outputs.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() < outPoint_.size() ) {
|
||||
<a name="l00131"></a>00131 oStream_ << <span class="stringliteral">"TapDelay::tick(): number of taps > channels in StkFrames argument!"</span>;
|
||||
<a name="l00132"></a>00132 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00133"></a>00133 }
|
||||
<a name="l00134"></a>00134 <span class="preprocessor">#endif</span>
|
||||
<a name="l00135"></a>00135 <span class="preprocessor"></span>
|
||||
<a name="l00136"></a>00136 inputs_[inPoint_++] = input * gain_;
|
||||
<a name="l00137"></a>00137
|
||||
<a name="l00138"></a>00138 <span class="comment">// Check for end condition</span>
|
||||
<a name="l00139"></a>00139 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00140"></a>00140 inPoint_ = 0;
|
||||
<a name="l00141"></a>00141
|
||||
<a name="l00142"></a>00142 <span class="comment">// Read out next values</span>
|
||||
<a name="l00143"></a>00143 StkFloat *outs = &outputs[0];
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<outPoint_.size(); i++ ) {
|
||||
<a name="l00145"></a>00145 *outs++ = inputs_[outPoint_[i]];
|
||||
<a name="l00146"></a>00146 lastFrame_[i] = *outs;
|
||||
<a name="l00147"></a>00147 <span class="keywordflow">if</span> ( ++outPoint_[i] == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() )
|
||||
<a name="l00148"></a>00148 outPoint_[i] = 0;
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">return</span> outputs;
|
||||
<a name="l00152"></a>00152 }
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a><a class="code" href="classstk_1_1TapDelay.html#a9255a00f0d7588ba5b51a12ba5db08c0">00154</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b" title="Input one sample to the delayline and return outputs at all tap positions.">TapDelay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00155"></a>00155 {
|
||||
<a name="l00156"></a>00156 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00157"></a>00157 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00158"></a>00158 oStream_ << <span class="stringliteral">"TapDelay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00159"></a>00159 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00160"></a>00160 }
|
||||
<a name="l00161"></a>00161 <span class="keywordflow">if</span> ( frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() < outPoint_.size() ) {
|
||||
<a name="l00162"></a>00162 oStream_ << <span class="stringliteral">"TapDelay::tick(): number of taps > channels in StkFrames argument!"</span>;
|
||||
<a name="l00163"></a>00163 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00164"></a>00164 }
|
||||
<a name="l00165"></a>00165 <span class="preprocessor">#endif</span>
|
||||
<a name="l00166"></a>00166 <span class="preprocessor"></span>
|
||||
<a name="l00167"></a>00167 StkFloat *iSamples = &frames[channel];
|
||||
<a name="l00168"></a>00168 StkFloat *oSamples = &frames[0];
|
||||
<a name="l00169"></a>00169 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, iHop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - outPoint_.size();
|
||||
<a name="l00170"></a>00170 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00171"></a>00171 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00172"></a>00172 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00173"></a>00173 <span class="keywordflow">for</span> ( j=0; j<outPoint_.size(); j++ ) {
|
||||
<a name="l00174"></a>00174 *oSamples++ = inputs_[outPoint_[j]];
|
||||
<a name="l00175"></a>00175 <span class="keywordflow">if</span> ( ++outPoint_[j] == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_[j] = 0;
|
||||
<a name="l00176"></a>00176 }
|
||||
<a name="l00177"></a>00177 }
|
||||
<a name="l00178"></a>00178
|
||||
<a name="l00179"></a>00179 oSamples -= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00180"></a>00180 <span class="keywordflow">for</span> ( j=0; j<outPoint_.size(); j++ ) lastFrame_[j] = *oSamples++;
|
||||
<a name="l00181"></a>00181 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00182"></a>00182 }
|
||||
<a name="l00183"></a>00183
|
||||
<a name="l00184"></a><a class="code" href="classstk_1_1TapDelay.html#ad8250d2802326bd3778c00642266d201">00184</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TapDelay.html#aadd431e206dd1e4133e2ff0d49aa639b" title="Input one sample to the delayline and return outputs at all tap positions.">TapDelay :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel )
|
||||
<a name="l00185"></a>00185 {
|
||||
<a name="l00186"></a>00186 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00187"></a>00187 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00188"></a>00188 oStream_ << <span class="stringliteral">"TapDelay::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00189"></a>00189 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00190"></a>00190 }
|
||||
<a name="l00191"></a>00191 <span class="keywordflow">if</span> ( oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() < outPoint_.size() ) {
|
||||
<a name="l00192"></a>00192 oStream_ << <span class="stringliteral">"TapDelay::tick(): number of taps > channels in output StkFrames argument!"</span>;
|
||||
<a name="l00193"></a>00193 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195 <span class="preprocessor">#endif</span>
|
||||
<a name="l00196"></a>00196 <span class="preprocessor"></span>
|
||||
<a name="l00197"></a>00197 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00198"></a>00198 StkFloat *oSamples = &oFrames[0];
|
||||
<a name="l00199"></a>00199 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - outPoint_.size();
|
||||
<a name="l00200"></a>00200 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00201"></a>00201 inputs_[inPoint_++] = *iSamples * gain_;
|
||||
<a name="l00202"></a>00202 <span class="keywordflow">if</span> ( inPoint_ == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) inPoint_ = 0;
|
||||
<a name="l00203"></a>00203 <span class="keywordflow">for</span> ( j=0; j<outPoint_.size(); j++ ) {
|
||||
<a name="l00204"></a>00204 *oSamples++ = inputs_[outPoint_[j]];
|
||||
<a name="l00205"></a>00205 <span class="keywordflow">if</span> ( ++outPoint_[j] == inputs_.<a class="code" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79" title="Returns the total number of audio samples represented by the object.">size</a>() ) outPoint_[j] = 0;
|
||||
<a name="l00206"></a>00206 }
|
||||
<a name="l00207"></a>00207 }
|
||||
<a name="l00208"></a>00208
|
||||
<a name="l00209"></a>00209 oSamples -= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00210"></a>00210 <span class="keywordflow">for</span> ( j=0; j<outPoint_.size(); j++ ) lastFrame_[j] = *oSamples++;
|
||||
<a name="l00211"></a>00211 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00212"></a>00212 }
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 <span class="preprocessor">#endif</span>
|
||||
<a name="l00215"></a>00215 <span class="preprocessor"></span>
|
||||
<a name="l00216"></a>00216 } <span class="comment">// stk namespace</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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
56
doc/html/TcpClient_8h_source.html
Normal file
56
doc/html/TcpClient_8h_source.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>TcpClient.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TCPCLIENT_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TCPCLIENT_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Socket.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="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1TcpClient.html">00033</a> <span class="keyword">class </span><a class="code" href="classstk_1_1TcpClient.html" title="STK TCP socket client class.">TcpClient</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a>
|
||||
<a name="l00034"></a>00034 {
|
||||
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1TcpClient.html#a1e1e2cf0981774147d516efcaf12e786" title="Default class constructor creates a socket client connection to the specified host...">TcpClient</a>( <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a>, std::string hostname = <span class="stringliteral">"localhost"</span> );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1TcpClient.html#ae4d515e14471f5d65730c6ccccb6f653" title="The class destructor closes the socket instance, breaking any existing connections...">~TcpClient</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1TcpClient.html#a46ff34075ef3a0342c396af5fe1aedda" title="Connect the socket client to the specified host and port and returns the resulting...">connect</a>( <span class="keywordtype">int</span> port, std::string hostname = <span class="stringliteral">"localhost"</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1TcpClient.html#af101788bd77c2026cc3ade330caf7fc5" title="Write a buffer over the socket connection. Returns the number of bytes written or...">writeBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1TcpClient.html#af0c6f44c9f3d3812a7d0cb79f94eba5f" title="Read a buffer from the socket connection, up to length bufferSize. Returns the number...">readBuffer</a>(<span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <span class="keyword">protected</span>:
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 };
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
56
doc/html/TcpServer_8h_source.html
Normal file
56
doc/html/TcpServer_8h_source.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>TcpServer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TCPSERVER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TCPSERVER_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Socket.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="l00031"></a>00031 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1TcpServer.html">00033</a> <span class="keyword">class </span><a class="code" href="classstk_1_1TcpServer.html" title="STK TCP socket server class.">TcpServer</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a>
|
||||
<a name="l00034"></a>00034 {
|
||||
<a name="l00035"></a>00035 <span class="keyword">public</span>:
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00040"></a>00040 <a class="code" href="classstk_1_1TcpServer.html#a0fc92fd76f406ab8eeabbeb27ba9a2fc" title="Default constructor creates a local socket server on port 2006 (or the specified...">TcpServer</a>( <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a> = 2006 );
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <a class="code" href="classstk_1_1TcpServer.html#a07ccec68a41a10fbe9f1e9e9db3a85bd" title="The class destructor closes the socket instance, breaking any existing connections...">~TcpServer</a>();
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1TcpServer.html#a421e255c3a250c5ac5d9e9642049cb9e" title="Extract the first pending connection request from the queue and create a new connection...">accept</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1TcpServer.html#a4294c5eac74ee54c5367c41e1ee01741" title="Write a buffer over the socket connection. Returns the number of bytes written or...">writeBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1TcpServer.html#aafdf74764425a3044093647661ed1927" title="Read a buffer from the socket connection, up to length bufferSize. Returns the number...">readBuffer</a>(<span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00059"></a>00059 <span class="keyword">protected</span>:
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 };
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00063"></a>00063 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00065"></a>00065 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
81
doc/html/Thread_8h_source.html
Normal file
81
doc/html/Thread_8h_source.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Thread.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_THREAD_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_THREAD_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__))</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor"></span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor"> #include <pthread.h></span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor"> #define THREAD_TYPE</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor"></span> <span class="keyword">typedef</span> pthread_t THREAD_HANDLE;
|
||||
<a name="l00011"></a>00011 <span class="keyword">typedef</span> <span class="keywordtype">void</span> * THREAD_RETURN;
|
||||
<a name="l00012"></a>00012 <span class="keyword">typedef</span> <span class="keywordtype">void</span> * (*THREAD_FUNCTION)(<span class="keywordtype">void</span> *);
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="preprocessor">#elif defined(__OS_WINDOWS__)</span>
|
||||
<a name="l00015"></a>00015 <span class="preprocessor"></span>
|
||||
<a name="l00016"></a>00016 <span class="preprocessor"> #include <windows.h></span>
|
||||
<a name="l00017"></a>00017 <span class="preprocessor"> #include <process.h></span>
|
||||
<a name="l00018"></a>00018 <span class="preprocessor"> #define THREAD_TYPE __stdcall</span>
|
||||
<a name="l00019"></a>00019 <span class="preprocessor"></span> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> THREAD_HANDLE;
|
||||
<a name="l00020"></a>00020 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> THREAD_RETURN;
|
||||
<a name="l00021"></a>00021 <span class="keyword">typedef</span> unsigned (__stdcall *THREAD_FUNCTION)(<span class="keywordtype">void</span> *);
|
||||
<a name="l00022"></a>00022
|
||||
<a name="l00023"></a>00023 <span class="preprocessor">#endif</span>
|
||||
<a name="l00024"></a>00024 <span class="preprocessor"></span>
|
||||
<a name="l00025"></a>00025 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00027"></a>00027 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00047"></a>00047 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00049"></a><a class="code" href="classstk_1_1Thread.html">00049</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Thread.html" title="STK thread class.">Thread</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00050"></a>00050 {
|
||||
<a name="l00051"></a>00051 <span class="keyword">public</span>:
|
||||
<a name="l00053"></a>00053 <a class="code" href="classstk_1_1Thread.html#a550db7efe16cd4ef223d9ca69dda384b" title="Default constructor.">Thread</a>();
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <a class="code" href="classstk_1_1Thread.html#af3a6c8bcfebeeda352286f46afda00b3" title="The class destructor does not attempt to cancel or join a thread.">~Thread</a>();
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Thread.html#abcafe21595d9c6ac52b1ae872b34a531" title="Begin execution of the thread routine. Upon success, true is returned.">start</a>( THREAD_FUNCTION routine, <span class="keywordtype">void</span> * ptr = NULL );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00074"></a>00074 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Thread.html#a7187695295a7e5faf780ca13b0c07d4e" title="Signal cancellation of a thread routine, returning true on success.">cancel</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00080"></a>00080 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1Thread.html#acce21fd2b9b62cd8116fefe499c8431f" title="Block the calling routine indefinitely until the thread terminates.">wait</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Thread.html#a351cf3ad12622606ea2d984ae2e29380" title="Create a cancellation point within a thread routine.">testCancel</a>(<span class="keywordtype">void</span>);
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 <span class="keyword">protected</span>:
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 THREAD_HANDLE thread_;
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00094"></a>00094 };
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a>00096 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00097"></a>00097
|
||||
<a name="l00098"></a>00098 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
107
doc/html/TubeBell_8h_source.html
Normal file
107
doc/html/TubeBell_8h_source.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.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#a7b5de1d681fcb5c2899094dc1ffe0453" 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#ab841ecb52b7be3b896d92b968364b529" 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#aa141536c51b4918dd5fae222e5cb6aa3" 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#afa7422b2a7361f2ebe60ebff887ef36f" 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="l00059"></a>00059
|
||||
<a name="l00066"></a>00066 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <span class="keyword">protected</span>:
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00070"></a>00070 };
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f">00072</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">TubeBell :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00073"></a>00073 {
|
||||
<a name="l00074"></a>00074 StkFloat temp, temp2;
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00077"></a>00077 temp = temp * control1_;
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00080"></a>00080 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00081"></a>00081 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00082"></a>00082 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( temp );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00084"></a>00084 waves_[2]->addPhaseOffset( temp );
|
||||
<a name="l00085"></a>00085 temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]-><a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">tick</a>() * waves_[0]->tick();
|
||||
<a name="l00086"></a>00086 temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <span class="comment">// Calculate amplitude modulation and apply it to output.</span>
|
||||
<a name="l00089"></a>00089 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_;
|
||||
<a name="l00090"></a>00090 temp = temp * (1.0 + temp2);
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a>00092 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00093"></a>00093 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00094"></a>00094 }
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a><a class="code" href="classstk_1_1TubeBell.html#a664cede881352aea1d300ca93ba416ac">00096</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">TubeBell :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00097"></a>00097 {
|
||||
<a name="l00098"></a>00098 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00099"></a>00099 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00100"></a>00100 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00101"></a>00101 oStream_ << <span class="stringliteral">"TubeBell::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00103"></a>00103 }
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#endif</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span>
|
||||
<a name="l00106"></a>00106 StkFloat *samples = &frames[channel];
|
||||
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00108"></a>00108 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00109"></a>00109 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00110"></a>00110 *samples++ = <a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00111"></a>00111 }
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">else</span> {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1TubeBell.html#afa7422b2a7361f2ebe60ebff887ef36f" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00116"></a>00116 *samples++ = lastFrame_[j];
|
||||
<a name="l00117"></a>00117 }
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00124"></a>00124
|
||||
<a name="l00125"></a>00125 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
127
doc/html/Twang_8h_source.html
Normal file
127
doc/html/Twang_8h_source.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Twang.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TWANG_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TWANG_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include "DelayA.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "DelayL.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Fir.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="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Twang.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Twang.html" title="STK enhanced plucked string class.">Twang</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Twang.html#a813e99ee79974707a3afbfcab963c086" title="Class constructor, taking the lowest desired playing frequency.">Twang</a>( StkFloat lowestFrequency = 50.0 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1Twang.html#adae2759ef254101f91aa3a0a5c3fba39" title="Class destructor.">~Twang</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Twang.html#a7cdd4bf2e486239429f6d4f0f277cea9" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Twang.html#ae27aa429cbf49f0dd60f0cc6ef41c832" title="Set the delayline parameters to allow frequencies as low as specified.">setLowestFrequency</a>( StkFloat frequency );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Twang.html#a0043b9d374b73b6660ec2d79475d602c" title="Set the delayline parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00051"></a>00051
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Twang.html#a48008e3cd55dad6ee846b47ab32f993f" title="Set the pluck or &quot;excitation&quot; position along the string (0.0 - 1.0).">setPluckPosition</a>( StkFloat position );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Twang.html#ad7921c51f38b4e6e32d7db48cc101068" title="Set the nominal loop gain.">setLoopGain</a>( StkFloat loopGain );
|
||||
<a name="l00063"></a>00063
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Twang.html#a7076c25dd3a06262b3bf927bc64bf89e" title="Set the loop filter coefficients.">setLoopFilter</a>( std::vector<StkFloat> coefficients );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a><a class="code" href="classstk_1_1Twang.html#ab54245fcb75144a8ffcc879789abc952">00073</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Twang.html#ab54245fcb75144a8ffcc879789abc952" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00076"></a>00076 StkFloat <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( StkFloat input );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00087"></a>00087 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00098"></a>00098 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a>00100 <span class="keyword">protected</span>:
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <a class="code" href="classstk_1_1DelayA.html" title="STK allpass interpolating delay line class.">DelayA</a> delayLine_;
|
||||
<a name="l00103"></a>00103 <a class="code" href="classstk_1_1DelayL.html" title="STK linear interpolating delay line class.">DelayL</a> combDelay_;
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1Fir.html" title="STK general finite impulse response filter class.">Fir</a> loopFilter_;
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> lastFrame_;
|
||||
<a name="l00107"></a>00107 StkFloat frequency_;
|
||||
<a name="l00108"></a>00108 StkFloat loopGain_;
|
||||
<a name="l00109"></a>00109 StkFloat pluckPosition_;
|
||||
<a name="l00110"></a>00110 };
|
||||
<a name="l00111"></a>00111
|
||||
<a name="l00112"></a><a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9">00112</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">Twang :: tick</a>( StkFloat input )
|
||||
<a name="l00113"></a>00113 {
|
||||
<a name="l00114"></a>00114 lastFrame_[0] = delayLine_.<a class="code" href="classstk_1_1DelayA.html#ae602abe91560fb5f141db52333359b74" title="Input one sample to the filter and return one output.">tick</a>( input + loopFilter_.<a class="code" href="classstk_1_1Fir.html#afc5fd95f6bf72edaf4ee3060ca947793" title="Input one sample to the filter and return one output.">tick</a>( delayLine_.<a class="code" href="classstk_1_1DelayA.html#a4372d0e178af1cb6ca465affddfb1566" title="Return the last computed output value.">lastOut</a>() ) );
|
||||
<a name="l00115"></a>00115 lastFrame_[0] -= combDelay_.<a class="code" href="classstk_1_1DelayL.html#a1d01bbaf40cc20a0b70241bb8072da7f" title="Input one sample to the filter and return one output.">tick</a>( lastFrame_[0] ); <span class="comment">// comb filtering on output</span>
|
||||
<a name="l00116"></a>00116
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">return</span> lastFrame_[0] * 0.5;
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a><a class="code" href="classstk_1_1Twang.html#ae9e770c446e1459a5e89c0bc8285f5e3">00120</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">Twang :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00121"></a>00121 {
|
||||
<a name="l00122"></a>00122 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00123"></a>00123 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00124"></a>00124 oStream_ << <span class="stringliteral">"Twang::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00125"></a>00125 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127 <span class="preprocessor">#endif</span>
|
||||
<a name="l00128"></a>00128 <span class="preprocessor"></span>
|
||||
<a name="l00129"></a>00129 StkFloat *samples = &frames[channel];
|
||||
<a name="l00130"></a>00130 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00131"></a>00131 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00132"></a>00132 *samples = <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( *samples );
|
||||
<a name="l00133"></a>00133
|
||||
<a name="l00134"></a>00134 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00135"></a>00135 }
|
||||
<a name="l00136"></a>00136
|
||||
<a name="l00137"></a><a class="code" href="classstk_1_1Twang.html#a089ff55338a22647d94665d6adbeb7ae">00137</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">Twang :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00138"></a>00138 {
|
||||
<a name="l00139"></a>00139 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00140"></a>00140 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00141"></a>00141 oStream_ << <span class="stringliteral">"Twang::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00142"></a>00142 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00143"></a>00143 }
|
||||
<a name="l00144"></a>00144 <span class="preprocessor">#endif</span>
|
||||
<a name="l00145"></a>00145 <span class="preprocessor"></span>
|
||||
<a name="l00146"></a>00146 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00147"></a>00147 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00148"></a>00148 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop )
|
||||
<a name="l00150"></a>00150 *oSamples = <a class="code" href="classstk_1_1Twang.html#a3441ff449e3f7a451873e67d4c680ce9" title="Compute and return one output sample.">tick</a>( *iSamples );
|
||||
<a name="l00151"></a>00151
|
||||
<a name="l00152"></a>00152 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154
|
||||
<a name="l00155"></a>00155 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00156"></a>00156
|
||||
<a name="l00157"></a>00157 <span class="preprocessor">#endif</span>
|
||||
<a name="l00158"></a>00158 <span class="preprocessor"></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
128
doc/html/TwoPole_8h_source.html
Normal file
128
doc/html/TwoPole_8h_source.html
Normal file
@@ -0,0 +1,128 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>TwoPole.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TWOPOLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TWOPOLE_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1TwoPole.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1TwoPole.html" title="STK two-pole filter class.">TwoPole</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00023"></a>00023
|
||||
<a name="l00025"></a>00025 <a class="code" href="classstk_1_1TwoPole.html#a01a2b3b3d286e00a097918ec5f8a287b" title="Default constructor creates a second-order pass-through filter.">TwoPole</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00026"></a>00026
|
||||
<a name="l00028"></a>00028 <a class="code" href="classstk_1_1TwoPole.html#aabc2e1046f8f908fc78a53b50b00ed9f" title="Class destructor.">~TwoPole</a>();
|
||||
<a name="l00029"></a>00029
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1TwoPole.html#ad0a3ac1b5d4e651a7ff1efb1d5362c0b">00031</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoPole.html#ad0a3ac1b5d4e651a7ff1efb1d5362c0b" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00032"></a>00032
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1TwoPole.html#a0a5bfc68061c1dbaa40bfbb9ddb67b7d">00034</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoPole.html#a0a5bfc68061c1dbaa40bfbb9ddb67b7d" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00037"></a><a class="code" href="classstk_1_1TwoPole.html#ad0c2f8ddc09ca1eb864515d816ebacdd">00037</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoPole.html#ad0c2f8ddc09ca1eb864515d816ebacdd" title="Set the a[1] coefficient value.">setA1</a>( StkFloat a1 ) { a_[1] = a1; };
|
||||
<a name="l00038"></a>00038
|
||||
<a name="l00040"></a><a class="code" href="classstk_1_1TwoPole.html#a309960a8b2cf6858f43f43dc739146ea">00040</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoPole.html#a309960a8b2cf6858f43f43dc739146ea" title="Set the a[2] coefficient value.">setA2</a>( StkFloat a2 ) { a_[2] = a2; };
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoPole.html#af9b68df9cc424a09e3ecb7f078bcacd3" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat a1, StkFloat a2, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoPole.html#a00997b12a1cf0a04888124eaf85c565d" title="Sets the filter coefficients for a resonance at frequency (in Hz).">setResonance</a>(StkFloat frequency, StkFloat radius, <span class="keywordtype">bool</span> normalize = <span class="keyword">false</span>);
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a><a class="code" href="classstk_1_1TwoPole.html#a8a4fb4afe3e06c689827ecaec478aad1">00064</a> StkFloat <a class="code" href="classstk_1_1TwoPole.html#a8a4fb4afe3e06c689827ecaec478aad1" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067 StkFloat <a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00078"></a>00078 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00089"></a>00089 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="keyword">protected</span>:
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00093"></a>00093 <span class="keyword">virtual</span> <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00094"></a>00094 };
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00096"></a><a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc">00096</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc" title="Input one sample to the filter and return one output.">TwoPole :: tick</a>( StkFloat input )
|
||||
<a name="l00097"></a>00097 {
|
||||
<a name="l00098"></a>00098 inputs_[0] = gain_ * input;
|
||||
<a name="l00099"></a>00099 lastFrame_[0] = b_[0] * inputs_[0] - a_[1] * outputs_[1] - a_[2] * outputs_[2];
|
||||
<a name="l00100"></a>00100 outputs_[2] = outputs_[1];
|
||||
<a name="l00101"></a>00101 outputs_[1] = lastFrame_[0];
|
||||
<a name="l00102"></a>00102
|
||||
<a name="l00103"></a>00103 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00104"></a>00104 }
|
||||
<a name="l00105"></a>00105
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1TwoPole.html#a9e8bd9ed925a1c4966fbc0b0799ce46b">00106</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc" title="Input one sample to the filter and return one output.">TwoPole :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00107"></a>00107 {
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00110"></a>00110 oStream_ << <span class="stringliteral">"TwoPole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00111"></a>00111 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00112"></a>00112 }
|
||||
<a name="l00113"></a>00113 <span class="preprocessor">#endif</span>
|
||||
<a name="l00114"></a>00114 <span class="preprocessor"></span>
|
||||
<a name="l00115"></a>00115 StkFloat *samples = &frames[channel];
|
||||
<a name="l00116"></a>00116 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00118"></a>00118 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00119"></a>00119 *samples = b_[0] * inputs_[0] - a_[1] * outputs_[1] - a_[2] * outputs_[2];
|
||||
<a name="l00120"></a>00120 outputs_[2] = outputs_[1];
|
||||
<a name="l00121"></a>00121 outputs_[1] = *samples;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00125"></a>00125 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00126"></a>00126 }
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a><a class="code" href="classstk_1_1TwoPole.html#a5c9b52082c0d2845a5ca01ca276fe8f8">00128</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoPole.html#ad4612f9b6f971a4dd76b23bb2b9fefbc" title="Input one sample to the filter and return one output.">TwoPole :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00129"></a>00129 {
|
||||
<a name="l00130"></a>00130 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00131"></a>00131 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00132"></a>00132 oStream_ << <span class="stringliteral">"TwoPole::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00133"></a>00133 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00134"></a>00134 }
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#endif</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span>
|
||||
<a name="l00137"></a>00137 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00138"></a>00138 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00139"></a>00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00140"></a>00140 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00141"></a>00141 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00142"></a>00142 *oSamples = b_[0] * inputs_[0] - a_[1] * outputs_[1] - a_[2] * outputs_[2];
|
||||
<a name="l00143"></a>00143 outputs_[2] = outputs_[1];
|
||||
<a name="l00144"></a>00144 outputs_[1] = *oSamples;
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 lastFrame_[0] = outputs_[1];
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00149"></a>00149 }
|
||||
<a name="l00150"></a>00150
|
||||
<a name="l00151"></a>00151 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00152"></a>00152
|
||||
<a name="l00153"></a>00153 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
127
doc/html/TwoZero_8h_source.html
Normal file
127
doc/html/TwoZero_8h_source.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>TwoZero.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_TWOZERO_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_TWOZERO_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Filter.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="l00018"></a>00018 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00019"></a>00019
|
||||
<a name="l00020"></a><a class="code" href="classstk_1_1TwoZero.html">00020</a> <span class="keyword">class </span><a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Filter.html" title="STK abstract filter class.">Filter</a>
|
||||
<a name="l00021"></a>00021 {
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a>00024 <a class="code" href="classstk_1_1TwoZero.html#a5dabe7ec659bedf76a8f8d975f36dcd9" title="Default constructor creates a second-order pass-through filter.">TwoZero</a>();
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a>00027 <a class="code" href="classstk_1_1TwoZero.html#ab9890b28f0770485494b05639a4b2140" title="Class destructor.">~TwoZero</a>();
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1TwoZero.html#aa1a1568aae3cd3d53011b3fc344cb086">00030</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoZero.html#aa1a1568aae3cd3d53011b3fc344cb086" title="A function to enable/disable the automatic updating of class data when the STK sample...">ignoreSampleRateChange</a>( <span class="keywordtype">bool</span> ignore = <span class="keyword">true</span> ) { ignoreSampleRateChange_ = ignore; };
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1TwoZero.html#a5ac82173333659fc31ca86cd2e134413">00033</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoZero.html#a5ac82173333659fc31ca86cd2e134413" title="Set the b[0] coefficient value.">setB0</a>( StkFloat b0 ) { b_[0] = b0; };
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a><a class="code" href="classstk_1_1TwoZero.html#a1f090992845b9c85f3de15dfba583891">00036</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoZero.html#a1f090992845b9c85f3de15dfba583891" title="Set the b[1] coefficient value.">setB1</a>( StkFloat b1 ) { b_[1] = b1; };
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1TwoZero.html#a98a7d6d1615753f338f75409d850a9b4">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoZero.html#a98a7d6d1615753f338f75409d850a9b4" title="Set the b[2] coefficient value.">setB2</a>( StkFloat b2 ) { b_[2] = b2; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoZero.html#a3c8449660561108eb1873ca6b820a939" title="Set all filter coefficients.">setCoefficients</a>( StkFloat b0, StkFloat b1, StkFloat b2, <span class="keywordtype">bool</span> clearState = <span class="keyword">false</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1TwoZero.html#a3a89facd2b94bbcfc2f06d8766a46329" title="Sets the filter coefficients for a &quot;notch&quot; at frequency (in Hz).">setNotch</a>( StkFloat frequency, StkFloat radius );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a><a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba">00060</a> StkFloat <a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_[0]; };
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 StkFloat <a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( StkFloat input );
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a>00066
|
||||
<a name="l00074"></a>00074 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> &oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel = 0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel = 0 );
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 <span class="keyword">protected</span>:
|
||||
<a name="l00088"></a>00088
|
||||
<a name="l00089"></a>00089 <span class="keywordtype">void</span> sampleRateChanged( StkFloat newRate, StkFloat oldRate );
|
||||
<a name="l00090"></a>00090 };
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00092"></a><a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82">00092</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">TwoZero :: tick</a>( StkFloat input )
|
||||
<a name="l00093"></a>00093 {
|
||||
<a name="l00094"></a>00094 inputs_[0] = gain_ * input;
|
||||
<a name="l00095"></a>00095 lastFrame_[0] = b_[2] * inputs_[2] + b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00096"></a>00096 inputs_[2] = inputs_[1];
|
||||
<a name="l00097"></a>00097 inputs_[1] = inputs_[0];
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a>00099 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00100"></a>00100 }
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a><a class="code" href="classstk_1_1TwoZero.html#a26e2a1e21831ccb414dbede864afc63c">00102</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">TwoZero :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00103"></a>00103 {
|
||||
<a name="l00104"></a>00104 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00105"></a>00105 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00106"></a>00106 oStream_ << <span class="stringliteral">"TwoZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00108"></a>00108 }
|
||||
<a name="l00109"></a>00109 <span class="preprocessor">#endif</span>
|
||||
<a name="l00110"></a>00110 <span class="preprocessor"></span>
|
||||
<a name="l00111"></a>00111 StkFloat *samples = &frames[channel];
|
||||
<a name="l00112"></a>00112 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00114"></a>00114 inputs_[0] = gain_ * *samples;
|
||||
<a name="l00115"></a>00115 *samples = b_[2] * inputs_[2] + b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00116"></a>00116 inputs_[2] = inputs_[1];
|
||||
<a name="l00117"></a>00117 inputs_[1] = inputs_[0];
|
||||
<a name="l00118"></a>00118 }
|
||||
<a name="l00119"></a>00119
|
||||
<a name="l00120"></a>00120 lastFrame_[0] = *(samples-hop);
|
||||
<a name="l00121"></a>00121 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a><a class="code" href="classstk_1_1TwoZero.html#a0ef9deab4fbc7e64511d4b6d38afd185">00124</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">TwoZero :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& iFrames, <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& oFrames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iChannel, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> oChannel )
|
||||
<a name="l00125"></a>00125 {
|
||||
<a name="l00126"></a>00126 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( iChannel >= iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() || oChannel >= oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00128"></a>00128 oStream_ << <span class="stringliteral">"TwoZero::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00129"></a>00129 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131 <span class="preprocessor">#endif</span>
|
||||
<a name="l00132"></a>00132 <span class="preprocessor"></span>
|
||||
<a name="l00133"></a>00133 StkFloat *iSamples = &iFrames[iChannel];
|
||||
<a name="l00134"></a>00134 StkFloat *oSamples = &oFrames[oChannel];
|
||||
<a name="l00135"></a>00135 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> iHop = iFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(), oHop = oFrames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00136"></a>00136 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<iFrames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, iSamples += iHop, oSamples += oHop ) {
|
||||
<a name="l00137"></a>00137 inputs_[0] = gain_ * *iSamples;
|
||||
<a name="l00138"></a>00138 *oSamples = b_[2] * inputs_[2] + b_[1] * inputs_[1] + b_[0] * inputs_[0];
|
||||
<a name="l00139"></a>00139 inputs_[2] = inputs_[1];
|
||||
<a name="l00140"></a>00140 inputs_[1] = inputs_[0];
|
||||
<a name="l00141"></a>00141 }
|
||||
<a name="l00142"></a>00142
|
||||
<a name="l00143"></a>00143 lastFrame_[0] = *(oSamples-oHop);
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">return</span> iFrames;
|
||||
<a name="l00145"></a>00145 }
|
||||
<a name="l00146"></a>00146
|
||||
<a name="l00147"></a>00147 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00148"></a>00148
|
||||
<a name="l00149"></a>00149 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
65
doc/html/UdpSocket_8h_source.html
Normal file
65
doc/html/UdpSocket_8h_source.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>UdpSocket.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_UDPSOCKET_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_UDPSOCKET_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Socket.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="l00029"></a>00029 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030
|
||||
<a name="l00031"></a><a class="code" href="classstk_1_1UdpSocket.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1UdpSocket.html" title="STK UDP socket server/client class.">UdpSocket</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">Socket</a>
|
||||
<a name="l00032"></a>00032 {
|
||||
<a name="l00033"></a>00033 <span class="keyword">public</span>:
|
||||
<a name="l00035"></a>00035
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1UdpSocket.html#aaad5171c74b4ab7c2155cd63ef30a271" title="Default constructor creates a local UDP socket on port 2006 (or the specified port...">UdpSocket</a>( <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a> = 2006 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041 <a class="code" href="classstk_1_1UdpSocket.html#a9b54f5d058c01c04dc266f117da7ee2a" title="The class destructor closes the socket instance.">~UdpSocket</a>();
|
||||
<a name="l00042"></a>00042
|
||||
<a name="l00044"></a>00044
|
||||
<a name="l00047"></a>00047 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1UdpSocket.html#a4267442661257aae2a0f6b48d367fea1" title="Set the address for subsequent outgoing data sent via the writeBuffer() function...">setDestination</a>( <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a> = 2006, std::string hostname = <span class="stringliteral">"localhost"</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1UdpSocket.html#aa9d3d734b4e9c811724eff626e849cb8" title="Send a buffer to the address specified with the setDestination() function. Returns...">writeBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1UdpSocket.html#a1f66fdcc40b07f9d56e472be9684adcb" title="Read an input buffer, up to length bufferSize. Returns the number of bytes read or...">readBuffer</a>(<span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> flags = 0);
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 <span class="keywordtype">int</span> <a class="code" href="classstk_1_1UdpSocket.html#a85f74161d2d3697593f08bda9dcb8963" title="Write a buffer to the specified socket. Returns the number of bytes written or -1...">writeBufferTo</a>(<span class="keyword">const</span> <span class="keywordtype">void</span> *buffer, <span class="keywordtype">long</span> bufferSize, <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Socket.html#abe3040ecfff6ce921284c6ab4b0500a7" title="Return the socket port number.">port</a>, std::string hostname = <span class="stringliteral">"localhost"</span>, <span class="keywordtype">int</span> flags = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00061"></a>00061 <span class="keyword">protected</span>:
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1UdpSocket.html#a785594fd882b76d4c280b72a016f026d" title="A protected function for use in writing a socket address structure.">setAddress</a>( <span class="keyword">struct</span> sockaddr_in *address, <span class="keywordtype">int</span> port = 2006, std::string hostname = <span class="stringliteral">"localhost"</span> );
|
||||
<a name="l00068"></a>00068
|
||||
<a name="l00069"></a>00069 <span class="keyword">struct </span>sockaddr_in address_;
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">bool</span> validAddress_;
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00072"></a>00072 };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00074"></a>00074 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00075"></a>00075
|
||||
<a name="l00076"></a>00076 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
76
doc/html/Vector3D_8h_source.html
Normal file
76
doc/html/Vector3D_8h_source.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Vector3D.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_VECTOR3D_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_VECTOR3D_H</span>
|
||||
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
||||
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
||||
<a name="l00005"></a>00005 <span class="preprocessor">#include <cmath></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00017"></a>00017 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00018"></a>00018
|
||||
<a name="l00019"></a><a class="code" href="classstk_1_1Vector3D.html">00019</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00020"></a>00020 {
|
||||
<a name="l00021"></a>00021
|
||||
<a name="l00022"></a>00022 <span class="keyword">public</span>:
|
||||
<a name="l00024"></a><a class="code" href="classstk_1_1Vector3D.html#a2e5ae76645aa8a89a8ab0640d3ce5292">00024</a> <a class="code" href="classstk_1_1Vector3D.html#a2e5ae76645aa8a89a8ab0640d3ce5292" title="Default constructor taking optional initial X, Y, and Z values.">Vector3D</a>( StkFloat x = 0.0, StkFloat y = 0.0, StkFloat z = 0.0 ) { <a class="code" href="classstk_1_1Vector3D.html#a65fd03de6d9d42ea53a6cb8418ee7149" title="Set the X, Y, and Z values simultaniously.">setXYZ</a>( x, y, z ); };
|
||||
<a name="l00025"></a>00025
|
||||
<a name="l00027"></a><a class="code" href="classstk_1_1Vector3D.html#ae4f7cddc34ed1cf80262ff2d5dad65f4">00027</a> StkFloat <a class="code" href="classstk_1_1Vector3D.html#ae4f7cddc34ed1cf80262ff2d5dad65f4" title="Get the current X value.">getX</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> X_; };
|
||||
<a name="l00028"></a>00028
|
||||
<a name="l00030"></a><a class="code" href="classstk_1_1Vector3D.html#af83bfbe865d702845e37e14d82f642b6">00030</a> StkFloat <a class="code" href="classstk_1_1Vector3D.html#af83bfbe865d702845e37e14d82f642b6" title="Get the current Y value.">getY</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> Y_; };
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00033"></a><a class="code" href="classstk_1_1Vector3D.html#af1c7389a2b4640cbe594fa33f9e4f805">00033</a> StkFloat <a class="code" href="classstk_1_1Vector3D.html#af1c7389a2b4640cbe594fa33f9e4f805" title="Get the current Z value.">getZ</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> Z_; };
|
||||
<a name="l00034"></a>00034
|
||||
<a name="l00036"></a>00036 StkFloat <a class="code" href="classstk_1_1Vector3D.html#a61b078f252c597feff6d98a5646b03fd" title="Calculate the vector length.">getLength</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00037"></a>00037
|
||||
<a name="l00039"></a><a class="code" href="classstk_1_1Vector3D.html#a65fd03de6d9d42ea53a6cb8418ee7149">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Vector3D.html#a65fd03de6d9d42ea53a6cb8418ee7149" title="Set the X, Y, and Z values simultaniously.">setXYZ</a>( StkFloat x, StkFloat y, StkFloat z ) { X_ = x; Y_ = y; Z_ = z; };
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a><a class="code" href="classstk_1_1Vector3D.html#a9825ba3adb8fb272d2e3ca20740a48c5">00042</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Vector3D.html#a9825ba3adb8fb272d2e3ca20740a48c5" title="Set the X value.">setX</a>( StkFloat x ) { X_ = x; };
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a><a class="code" href="classstk_1_1Vector3D.html#a94de5326b083c6cf72f509aa0fc532f3">00045</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Vector3D.html#a94de5326b083c6cf72f509aa0fc532f3" title="Set the Y value.">setY</a>( StkFloat y ) { Y_ = y; };
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a><a class="code" href="classstk_1_1Vector3D.html#a826f2aa5e7b95a0d91f9432f26bec881">00048</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Vector3D.html#a826f2aa5e7b95a0d91f9432f26bec881" title="Set the Z value.">setZ</a>( StkFloat z ) { Z_ = z; };
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00050"></a>00050 <span class="keyword">protected</span>:
|
||||
<a name="l00051"></a>00051 StkFloat X_;
|
||||
<a name="l00052"></a>00052 StkFloat Y_;
|
||||
<a name="l00053"></a>00053 StkFloat Z_;
|
||||
<a name="l00054"></a>00054 };
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00056"></a><a class="code" href="classstk_1_1Vector3D.html#a61b078f252c597feff6d98a5646b03fd">00056</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Vector3D.html#a61b078f252c597feff6d98a5646b03fd" title="Calculate the vector length.">Vector3D :: getLength</a>( <span class="keywordtype">void</span> )
|
||||
<a name="l00057"></a>00057 {
|
||||
<a name="l00058"></a>00058 StkFloat temp;
|
||||
<a name="l00059"></a>00059 temp = X_ * X_;
|
||||
<a name="l00060"></a>00060 temp += Y_ * Y_;
|
||||
<a name="l00061"></a>00061 temp += Z_ * Z_;
|
||||
<a name="l00062"></a>00062 temp = sqrt( temp );
|
||||
<a name="l00063"></a>00063 <span class="keywordflow">return</span> temp;
|
||||
<a name="l00064"></a>00064 }
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00066"></a>00066 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00068"></a>00068 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
137
doc/html/VoicForm_8h_source.html
Normal file
137
doc/html/VoicForm_8h_source.html
Normal file
@@ -0,0 +1,137 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>VoicForm.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_VOICFORM_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_VOICFORM_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 "Noise.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "SingWave.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "FormSwep.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "OneZero.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00039"></a>00039 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00041"></a><a class="code" href="classstk_1_1VoicForm.html">00041</a> <span class="keyword">class </span><a class="code" href="classstk_1_1VoicForm.html" title="Four formant synthesis instrument.">VoicForm</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00042"></a>00042 {
|
||||
<a name="l00043"></a>00043 <span class="keyword">public</span>:
|
||||
<a name="l00045"></a>00045
|
||||
<a name="l00048"></a>00048 <a class="code" href="classstk_1_1VoicForm.html#a9462c5ba6b627f5508c336153510de4c" title="Class constructor.">VoicForm</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <a class="code" href="classstk_1_1VoicForm.html#a298da1434bf38e6bf83c2f9db78f01ac" title="Class destructor.">~VoicForm</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#ad62987970200d4e9720190b884fb689d" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#aeb2b7ffe130e016c847cd7aebfd628ee" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1VoicForm.html#a6ee860f09b9598c1251a9653b50139bb" title="Set instrument parameters for the given phoneme. Returns false if phoneme not found...">setPhoneme</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* phoneme );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a><a class="code" href="classstk_1_1VoicForm.html#acd504d4d29134a778b08b2229dd0c0c9">00063</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#acd504d4d29134a778b08b2229dd0c0c9" title="Set the voiced component gain.">setVoiced</a>( StkFloat vGain ) { voiced_-><a class="code" href="classstk_1_1SingWave.html#ac248b298dd095bd7c9ed2c84a229a55f" title="Set the gain target value.">setGainTarget</a>(vGain); };
|
||||
<a name="l00064"></a>00064
|
||||
<a name="l00066"></a><a class="code" href="classstk_1_1VoicForm.html#aa4fa86def4ded3698f75c0e4bdbdf638">00066</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#aa4fa86def4ded3698f75c0e4bdbdf638" title="Set the unvoiced component gain.">setUnVoiced</a>( StkFloat nGain ) { noiseEnv_.<a class="code" href="classstk_1_1Envelope.html#a5269bc5dc1d56161ab82b677b5462a3e" title="Set the target value.">setTarget</a>(nGain); };
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#a14d8323edda6e8c82ab39d633b8064a8" title="Set the sweep rate for a particular formant filter (0-3).">setFilterSweepRate</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> whichOne, StkFloat rate );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00072"></a><a class="code" href="classstk_1_1VoicForm.html#a2e4adfe6542f6103a8ac85c7ea2f2ce5">00072</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#a2e4adfe6542f6103a8ac85c7ea2f2ce5" title="Set voiced component pitch sweep rate.">setPitchSweepRate</a>( StkFloat rate ) { voiced_-><a class="code" href="classstk_1_1SingWave.html#ab80c50b3c8fc05f056221452504aa150" title="Set the sweep rate.">setSweepRate</a>(rate); };
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1VoicForm.html#a425c88ad505e260604771cfe3de6ed47">00075</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#a425c88ad505e260604771cfe3de6ed47" title="Start the voice.">speak</a>( <span class="keywordtype">void</span> ) { voiced_-><a class="code" href="classstk_1_1SingWave.html#a9bd638590605e5b5eb679467506e42ff" title="Start a note.">noteOn</a>(); };
|
||||
<a name="l00076"></a>00076
|
||||
<a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#a33cacda32d42f3282312043c54b3cee7" title="Stop the voice.">quiet</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#a9f8431ef3c7588c0d032e821d4dd1ad9" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00082"></a>00082
|
||||
<a name="l00084"></a><a class="code" href="classstk_1_1VoicForm.html#ab9e54927b3bec7b9727c32791bbb9b19">00084</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#ab9e54927b3bec7b9727c32791bbb9b19" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude ) { this-><a class="code" href="classstk_1_1VoicForm.html#a33cacda32d42f3282312043c54b3cee7" title="Stop the voice.">quiet</a>(); };
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1VoicForm.html#a427ca45d3e44e093c11f16e30fc2b550" 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="l00088"></a>00088
|
||||
<a name="l00090"></a>00090 StkFloat <a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00091"></a>00091
|
||||
<a name="l00093"></a>00093
|
||||
<a name="l00100"></a>00100 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00102"></a>00102 <span class="keyword">protected</span>:
|
||||
<a name="l00103"></a>00103
|
||||
<a name="l00104"></a>00104 <a class="code" href="classstk_1_1SingWave.html" title="STK &quot;singing&quot; looped soundfile class.">SingWave</a> *voiced_;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> noiseEnv_;
|
||||
<a name="l00107"></a>00107 <a class="code" href="classstk_1_1FormSwep.html" title="STK sweepable formant filter class.">FormSwep</a> filters_[4];
|
||||
<a name="l00108"></a>00108 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> onepole_;
|
||||
<a name="l00109"></a>00109 <a class="code" href="classstk_1_1OneZero.html" title="STK one-zero filter class.">OneZero</a> onezero_;
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00111"></a>00111 };
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00113"></a><a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29">00113</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29" title="Compute and return one output sample.">VoicForm :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00114"></a>00114 {
|
||||
<a name="l00115"></a>00115 StkFloat temp;
|
||||
<a name="l00116"></a>00116 temp = onepole_.<a class="code" href="classstk_1_1OnePole.html#a3c83b6d43f76bec06f11caa9de76881e" title="Input one sample to the filter and return one output.">tick</a>( onezero_.<a class="code" href="classstk_1_1OneZero.html#a9f52fa395257b15cb7351c6ccb2199da" title="Input one sample to the filter and return one output.">tick</a>( voiced_-><a class="code" href="classstk_1_1SingWave.html#a45136f9bf5b6f58433d4d65864d9db78" title="Compute and return one output sample.">tick</a>() ) );
|
||||
<a name="l00117"></a>00117 temp += noiseEnv_.<a class="code" href="classstk_1_1Envelope.html#a8de91b9caf10a03f52bd2247648c4601" title="Compute and return one output sample.">tick</a>() * noise_.<a class="code" href="classstk_1_1Noise.html#a8ac40f69475eb744e803d557e8438a6d" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00118"></a>00118 lastFrame_[0] = filters_[0].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>(temp);
|
||||
<a name="l00119"></a>00119 lastFrame_[0] += filters_[1].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>(temp);
|
||||
<a name="l00120"></a>00120 lastFrame_[0] += filters_[2].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>(temp);
|
||||
<a name="l00121"></a>00121 lastFrame_[0] += filters_[3].<a class="code" href="classstk_1_1FormSwep.html#aba0d15e1d102cb0fee0806e1bb05c774" title="Input one sample to the filter and return a reference to one output.">tick</a>(temp);
|
||||
<a name="l00122"></a>00122 <span class="comment">/*</span>
|
||||
<a name="l00123"></a>00123 <span class="comment"> temp += noiseEnv_.tick() * noise_.tick();</span>
|
||||
<a name="l00124"></a>00124 <span class="comment"> lastFrame_[0] = filters_[0].tick(temp);</span>
|
||||
<a name="l00125"></a>00125 <span class="comment"> lastFrame_[0] = filters_[1].tick(lastFrame_[0]);</span>
|
||||
<a name="l00126"></a>00126 <span class="comment"> lastFrame_[0] = filters_[2].tick(lastFrame_[0]);</span>
|
||||
<a name="l00127"></a>00127 <span class="comment"> lastFrame_[0] = filters_[3].tick(lastFrame_[0]);</span>
|
||||
<a name="l00128"></a>00128 <span class="comment"> */</span>
|
||||
<a name="l00129"></a>00129 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00130"></a>00130 }
|
||||
<a name="l00131"></a>00131
|
||||
<a name="l00132"></a><a class="code" href="classstk_1_1VoicForm.html#a619d2995894216181c2dc38fd863fe33">00132</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29" title="Compute and return one output sample.">VoicForm :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00133"></a>00133 {
|
||||
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00135"></a>00135 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00136"></a>00136 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00137"></a>00137 oStream_ << <span class="stringliteral">"VoicForm::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00138"></a>00138 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00139"></a>00139 }
|
||||
<a name="l00140"></a>00140 <span class="preprocessor">#endif</span>
|
||||
<a name="l00141"></a>00141 <span class="preprocessor"></span>
|
||||
<a name="l00142"></a>00142 StkFloat *samples = &frames[channel];
|
||||
<a name="l00143"></a>00143 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00144"></a>00144 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00145"></a>00145 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00146"></a>00146 *samples++ = <a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00147"></a>00147 }
|
||||
<a name="l00148"></a>00148 <span class="keywordflow">else</span> {
|
||||
<a name="l00149"></a>00149 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00150"></a>00150 *samples++ = <a class="code" href="classstk_1_1VoicForm.html#ac12629d2730f582e405b221e1d7b6f29" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00151"></a>00151 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00152"></a>00152 *samples++ = lastFrame_[j];
|
||||
<a name="l00153"></a>00153 }
|
||||
<a name="l00154"></a>00154 }
|
||||
<a name="l00155"></a>00155
|
||||
<a name="l00156"></a>00156 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00157"></a>00157 }
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00160"></a>00160
|
||||
<a name="l00161"></a>00161 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
160
doc/html/Voicer_8h_source.html
Normal file
160
doc/html/Voicer_8h_source.html
Normal file
@@ -0,0 +1,160 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Voicer.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_VOICER_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_VOICER_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 <vector></span>
|
||||
<a name="l00006"></a>00006
|
||||
<a name="l00007"></a>00007 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00008"></a>00008
|
||||
<a name="l00009"></a>00009 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00032"></a>00032 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00033"></a>00033
|
||||
<a name="l00034"></a><a class="code" href="classstk_1_1Voicer.html">00034</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Voicer.html" title="STK voice manager class.">Voicer</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
||||
<a name="l00035"></a>00035 {
|
||||
<a name="l00036"></a>00036 <span class="keyword">public</span>:
|
||||
<a name="l00038"></a>00038 <a class="code" href="classstk_1_1Voicer.html#a4b2eb777e91f0dd33403ec23c68bb43f" title="Class constructor taking an optional note decay time (in seconds).">Voicer</a>( StkFloat decayTime = 0.2 );
|
||||
<a name="l00039"></a>00039
|
||||
<a name="l00041"></a>00041
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#aff9fc9304ef6ae9f7aa1e15611728b8c" title="Add an instrument with an optional group number to the voice manager.">addInstrument</a>( <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> *instrument, <span class="keywordtype">int</span> group=0 );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#ac5190f84fb8507cac2a18dece242d4d8" title="Remove the given instrument pointer from the voice manager&#39;s control.">removeInstrument</a>( <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> *instrument );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056
|
||||
<a name="l00064"></a>00064 <span class="keywordtype">long</span> <a class="code" href="classstk_1_1Voicer.html#abd09d3a8e935fe36776f165038e33176" title="Initiate a noteOn event with the given note number and amplitude and return a unique...">noteOn</a>( StkFloat noteNumber, StkFloat amplitude, <span class="keywordtype">int</span> group=0 );
|
||||
<a name="l00065"></a>00065
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00070"></a>00070 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#a4843895d8e4c0fffdd165aa480e2dcde" title="Send a noteOff to all voices having the given noteNumber and optional group (default...">noteOff</a>( StkFloat noteNumber, StkFloat amplitude, <span class="keywordtype">int</span> group=0 );
|
||||
<a name="l00071"></a>00071
|
||||
<a name="l00073"></a>00073
|
||||
<a name="l00076"></a>00076 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#a4843895d8e4c0fffdd165aa480e2dcde" title="Send a noteOff to all voices having the given noteNumber and optional group (default...">noteOff</a>( <span class="keywordtype">long</span> tag, StkFloat amplitude );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#a5ee3f8a17e031430486e030520709acf" title="Send a frequency update message to all voices assigned to the optional group argument...">setFrequency</a>( StkFloat noteNumber, <span class="keywordtype">int</span> group=0 );
|
||||
<a name="l00083"></a>00083
|
||||
<a name="l00085"></a>00085
|
||||
<a name="l00088"></a>00088 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#a5ee3f8a17e031430486e030520709acf" title="Send a frequency update message to all voices assigned to the optional group argument...">setFrequency</a>( <span class="keywordtype">long</span> tag, StkFloat noteNumber );
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00091"></a>00091 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#ae2ab6a6804960c686509d7f919829ad4" title="Send a pitchBend message to all voices assigned to the optional group argument (default...">pitchBend</a>( StkFloat value, <span class="keywordtype">int</span> group=0 );
|
||||
<a name="l00092"></a>00092
|
||||
<a name="l00094"></a>00094 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#ae2ab6a6804960c686509d7f919829ad4" title="Send a pitchBend message to all voices assigned to the optional group argument (default...">pitchBend</a>( <span class="keywordtype">long</span> tag, StkFloat value );
|
||||
<a name="l00095"></a>00095
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#ab5fe99a639a872c90aed2541417cc896" title="Send a controlChange to all instruments assigned to the optional group argument (default...">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value, <span class="keywordtype">int</span> group=0 );
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#ab5fe99a639a872c90aed2541417cc896" title="Send a controlChange to all instruments assigned to the optional group argument (default...">controlChange</a>( <span class="keywordtype">long</span> tag, <span class="keywordtype">int</span> number, StkFloat value );
|
||||
<a name="l00101"></a>00101
|
||||
<a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Voicer.html#a238f0936f6c0b54c7eb756ad3ac1f019" title="Send a noteOff message to all existing voices.">silence</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00104"></a>00104
|
||||
<a name="l00106"></a><a class="code" href="classstk_1_1Voicer.html#a35230ae97772ae581fb9658a5f4d57b6">00106</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1Voicer.html#a35230ae97772ae581fb9658a5f4d57b6" title="Return the current number of output channels.">channelsOut</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
|
||||
<a name="l00107"></a>00107
|
||||
<a name="l00109"></a><a class="code" href="classstk_1_1Voicer.html#a50caec57c6a566e4836181774adf5e7b">00109</a> <span class="keyword">const</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Voicer.html#a50caec57c6a566e4836181774adf5e7b" title="Return an StkFrames reference to the last output sample frame.">lastFrame</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> lastFrame_; };
|
||||
<a name="l00110"></a>00110
|
||||
<a name="l00112"></a>00112
|
||||
<a name="l00120"></a>00120 StkFloat <a class="code" href="classstk_1_1Voicer.html#a98d843fa1f9fd2ad9a9fb03538dba03a" title="Return the specified channel value of the last computed frame.">lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00121"></a>00121
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00131"></a>00131 StkFloat <a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00132"></a>00132
|
||||
<a name="l00134"></a>00134
|
||||
<a name="l00142"></a>00142 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00143"></a>00143
|
||||
<a name="l00144"></a>00144 <span class="keyword">protected</span>:
|
||||
<a name="l00145"></a>00145
|
||||
<a name="l00146"></a>00146 <span class="keyword">struct </span>Voice {
|
||||
<a name="l00147"></a>00147 <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a> *instrument;
|
||||
<a name="l00148"></a>00148 <span class="keywordtype">long</span> tag;
|
||||
<a name="l00149"></a>00149 StkFloat noteNumber;
|
||||
<a name="l00150"></a>00150 StkFloat frequency;
|
||||
<a name="l00151"></a>00151 <span class="keywordtype">int</span> sounding;
|
||||
<a name="l00152"></a>00152 <span class="keywordtype">int</span> group;
|
||||
<a name="l00153"></a>00153
|
||||
<a name="l00154"></a>00154 <span class="comment">// Default constructor.</span>
|
||||
<a name="l00155"></a>00155 Voice()
|
||||
<a name="l00156"></a>00156 :instrument(0), tag(0), noteNumber(-1.0), frequency(0.0), sounding(0), group(0) {}
|
||||
<a name="l00157"></a>00157 };
|
||||
<a name="l00158"></a>00158
|
||||
<a name="l00159"></a>00159 std::vector<Voice> voices_;
|
||||
<a name="l00160"></a>00160 <span class="keywordtype">long</span> tags_;
|
||||
<a name="l00161"></a>00161 <span class="keywordtype">int</span> muteTime_;
|
||||
<a name="l00162"></a>00162 StkFrames lastFrame_;
|
||||
<a name="l00163"></a>00163 };
|
||||
<a name="l00164"></a>00164
|
||||
<a name="l00165"></a><a class="code" href="classstk_1_1Voicer.html#a98d843fa1f9fd2ad9a9fb03538dba03a">00165</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Voicer.html#a98d843fa1f9fd2ad9a9fb03538dba03a" title="Return the specified channel value of the last computed frame.">Voicer :: lastOut</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00166"></a>00166 {
|
||||
<a name="l00167"></a>00167 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00168"></a>00168 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() ) {
|
||||
<a name="l00169"></a>00169 oStream_ << <span class="stringliteral">"Voicer::lastOut(): channel argument is invalid!"</span>;
|
||||
<a name="l00170"></a>00170 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00171"></a>00171 }
|
||||
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
|
||||
<a name="l00173"></a>00173 <span class="preprocessor"></span>
|
||||
<a name="l00174"></a>00174 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00175"></a>00175 }
|
||||
<a name="l00176"></a>00176
|
||||
<a name="l00177"></a>00177
|
||||
<a name="l00178"></a><a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70">00178</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">Voicer :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00179"></a>00179 {
|
||||
<a name="l00180"></a>00180 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j;
|
||||
<a name="l00181"></a>00181 <span class="keywordflow">for</span> ( j=0; j<lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); j++ ) lastFrame_[j] = 0.0;
|
||||
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<voices_.size(); i++ ) {
|
||||
<a name="l00183"></a>00183 <span class="keywordflow">if</span> ( voices_[i].sounding != 0 ) {
|
||||
<a name="l00184"></a>00184 voices_[i].instrument->tick();
|
||||
<a name="l00185"></a>00185 <span class="keywordflow">for</span> ( j=0; j<voices_[i].instrument->channelsOut(); j++ ) lastFrame_[j] += voices_[i].instrument->lastOut( j );
|
||||
<a name="l00186"></a>00186 }
|
||||
<a name="l00187"></a>00187 <span class="keywordflow">if</span> ( voices_[i].sounding < 0 )
|
||||
<a name="l00188"></a>00188 voices_[i].sounding++;
|
||||
<a name="l00189"></a>00189 <span class="keywordflow">if</span> ( voices_[i].sounding == 0 )
|
||||
<a name="l00190"></a>00190 voices_[i].noteNumber = -1;
|
||||
<a name="l00191"></a>00191 }
|
||||
<a name="l00192"></a>00192
|
||||
<a name="l00193"></a>00193 <span class="keywordflow">return</span> lastFrame_[channel];
|
||||
<a name="l00194"></a>00194 }
|
||||
<a name="l00195"></a>00195
|
||||
<a name="l00196"></a><a class="code" href="classstk_1_1Voicer.html#a3fd795b0fce684c470484936ef39aa16">00196</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">Voicer :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00197"></a>00197 {
|
||||
<a name="l00198"></a>00198 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00199"></a>00199 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00200"></a>00200 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00201"></a>00201 oStream_ << <span class="stringliteral">"Voicer::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00202"></a>00202 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00203"></a>00203 }
|
||||
<a name="l00204"></a>00204 <span class="preprocessor">#endif</span>
|
||||
<a name="l00205"></a>00205 <span class="preprocessor"></span>
|
||||
<a name="l00206"></a>00206 StkFloat *samples = &frames[channel];
|
||||
<a name="l00207"></a>00207 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00208"></a>00208 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00209"></a>00209 <a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">tick</a>();
|
||||
<a name="l00210"></a>00210 <span class="keywordflow">for</span> ( j=0; j<nChannels; j++ )
|
||||
<a name="l00211"></a>00211 *samples++ = lastFrame_[j];
|
||||
<a name="l00212"></a>00212 }
|
||||
<a name="l00213"></a>00213
|
||||
<a name="l00214"></a>00214 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00215"></a>00215 }
|
||||
<a name="l00216"></a>00216
|
||||
<a name="l00217"></a>00217 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00218"></a>00218
|
||||
<a name="l00219"></a>00219 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
118
doc/html/Whistle_8h_source.html
Normal file
118
doc/html/Whistle_8h_source.html
Normal file
@@ -0,0 +1,118 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Whistle.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_WHISTLE_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_WHISTLE_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 "Sphere.h"</span>
|
||||
<a name="l00006"></a>00006 <span class="preprocessor">#include "Vector3D.h"</span>
|
||||
<a name="l00007"></a>00007 <span class="preprocessor">#include "Noise.h"</span>
|
||||
<a name="l00008"></a>00008 <span class="preprocessor">#include "SineWave.h"</span>
|
||||
<a name="l00009"></a>00009 <span class="preprocessor">#include "OnePole.h"</span>
|
||||
<a name="l00010"></a>00010 <span class="preprocessor">#include "Envelope.h"</span>
|
||||
<a name="l00011"></a>00011
|
||||
<a name="l00012"></a>00012 <span class="keyword">namespace </span>stk {
|
||||
<a name="l00013"></a>00013
|
||||
<a name="l00014"></a>00014 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00030"></a>00030 <span class="comment">/***************************************************/</span>
|
||||
<a name="l00031"></a>00031
|
||||
<a name="l00032"></a><a class="code" href="classstk_1_1Whistle.html">00032</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Whistle.html" title="STK police/referee whistle instrument class.">Whistle</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
||||
<a name="l00033"></a>00033 {
|
||||
<a name="l00034"></a>00034 <span class="keyword">public</span>:
|
||||
<a name="l00036"></a>00036
|
||||
<a name="l00039"></a>00039 <a class="code" href="classstk_1_1Whistle.html#ae577e98aaf1957164155e4247f39a604" title="Class constructor.">Whistle</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00040"></a>00040
|
||||
<a name="l00042"></a>00042 <a class="code" href="classstk_1_1Whistle.html#ab44c607efebd6d6d53bf06b95636a90b" title="Class destructor.">~Whistle</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00043"></a>00043
|
||||
<a name="l00045"></a>00045 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#a8551209b9079d3bc626702e0745b2eb8" title="Reset and clear all internal state.">clear</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00046"></a>00046
|
||||
<a name="l00048"></a>00048 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#a6fd2ded34c6bfda618d80d7068e829d4" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00049"></a>00049
|
||||
<a name="l00051"></a>00051 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#ade1532d8b10e8b3ce7dfecba86514eaa" title="Apply breath velocity to instrument with given amplitude and rate of increase.">startBlowing</a>( StkFloat amplitude, StkFloat rate );
|
||||
<a name="l00052"></a>00052
|
||||
<a name="l00054"></a>00054 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#a6f529770c888caca50fc35f454c98898" title="Decrease breath velocity with given rate of decrease.">stopBlowing</a>( StkFloat rate );
|
||||
<a name="l00055"></a>00055
|
||||
<a name="l00057"></a>00057 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#ab8b80cab3827a6cf2bb95393c522c58b" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00058"></a>00058
|
||||
<a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#a50c5a97cebe6f7dbb6615ab3e76e41e0" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
||||
<a name="l00061"></a>00061
|
||||
<a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Whistle.html#a7d5d2d24fb0103aae0fb8c6308e2a663" 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="l00064"></a>00064
|
||||
<a name="l00066"></a>00066 StkFloat <a class="code" href="classstk_1_1Whistle.html#a3835e290dae97acfe79e1f7458a39cda" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00067"></a>00067
|
||||
<a name="l00069"></a>00069
|
||||
<a name="l00076"></a>00076 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Whistle.html#a3835e290dae97acfe79e1f7458a39cda" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00077"></a>00077
|
||||
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
|
||||
<a name="l00079"></a>00079
|
||||
<a name="l00080"></a>00080 <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> *tempVectorP_;
|
||||
<a name="l00081"></a>00081 <a class="code" href="classstk_1_1Vector3D.html" title="STK 3D vector class.">Vector3D</a> tempVector_;
|
||||
<a name="l00082"></a>00082 <a class="code" href="classstk_1_1OnePole.html" title="STK one-pole filter class.">OnePole</a> onepole_;
|
||||
<a name="l00083"></a>00083 <a class="code" href="classstk_1_1Noise.html" title="STK noise generator.">Noise</a> noise_;
|
||||
<a name="l00084"></a>00084 <a class="code" href="classstk_1_1Envelope.html" title="STK linear line envelope class.">Envelope</a> envelope_;
|
||||
<a name="l00085"></a>00085 <a class="code" href="classstk_1_1Sphere.html" title="STK sphere class.">Sphere</a> can_; <span class="comment">// Declare a Spherical "can".</span>
|
||||
<a name="l00086"></a>00086 <a class="code" href="classstk_1_1Sphere.html" title="STK sphere class.">Sphere</a> pea_, bumper_; <span class="comment">// One spherical "pea", and a spherical "bumper".</span>
|
||||
<a name="l00087"></a>00087
|
||||
<a name="l00088"></a>00088 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> sine_;
|
||||
<a name="l00089"></a>00089
|
||||
<a name="l00090"></a>00090 StkFloat baseFrequency_;
|
||||
<a name="l00091"></a>00091 StkFloat noiseGain_;
|
||||
<a name="l00092"></a>00092 StkFloat fippleFreqMod_;
|
||||
<a name="l00093"></a>00093 StkFloat fippleGainMod_;
|
||||
<a name="l00094"></a>00094 StkFloat blowFreqMod_;
|
||||
<a name="l00095"></a>00095 StkFloat tickSize_;
|
||||
<a name="l00096"></a>00096 StkFloat canLoss_;
|
||||
<a name="l00097"></a>00097 <span class="keywordtype">int</span> subSample_, subSampCount_;
|
||||
<a name="l00098"></a>00098 };
|
||||
<a name="l00099"></a>00099
|
||||
<a name="l00100"></a><a class="code" href="classstk_1_1Whistle.html#a46135035da33d0825e3ff0db04b857d4">00100</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Whistle.html#a3835e290dae97acfe79e1f7458a39cda" title="Compute and return one output sample.">Whistle :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00101"></a>00101 {
|
||||
<a name="l00102"></a>00102 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00103"></a>00103 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00104"></a>00104 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00105"></a>00105 oStream_ << <span class="stringliteral">"Whistle::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00107"></a>00107 }
|
||||
<a name="l00108"></a>00108 <span class="preprocessor">#endif</span>
|
||||
<a name="l00109"></a>00109 <span class="preprocessor"></span>
|
||||
<a name="l00110"></a>00110 StkFloat *samples = &frames[channel];
|
||||
<a name="l00111"></a>00111 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00113"></a>00113 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00114"></a>00114 *samples++ = <a class="code" href="classstk_1_1Whistle.html#a3835e290dae97acfe79e1f7458a39cda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00115"></a>00115 }
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">else</span> {
|
||||
<a name="l00117"></a>00117 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00118"></a>00118 *samples++ = <a class="code" href="classstk_1_1Whistle.html#a3835e290dae97acfe79e1f7458a39cda" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00119"></a>00119 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00120"></a>00120 *samples++ = lastFrame_[j];
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122 }
|
||||
<a name="l00123"></a>00123
|
||||
<a name="l00124"></a>00124 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00125"></a>00125 }
|
||||
<a name="l00126"></a>00126
|
||||
<a name="l00127"></a>00127 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00128"></a>00128 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
109
doc/html/Wurley_8h_source.html
Normal file
109
doc/html/Wurley_8h_source.html
Normal file
@@ -0,0 +1,109 @@
|
||||
<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_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
||||
</div>
|
||||
<div class="contents">
|
||||
<h1>Wurley.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_WURLEY_H</span>
|
||||
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_WURLEY_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_1Wurley.html">00040</a> <span class="keyword">class </span><a class="code" href="classstk_1_1Wurley.html" title="STK Wurlitzer electric piano FM synthesis instrument.">Wurley</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_1Wurley.html#afb2a68449dcd9902f0f037504387c52f" title="Class constructor.">Wurley</a>( <span class="keywordtype">void</span> );
|
||||
<a name="l00048"></a>00048
|
||||
<a name="l00050"></a>00050 <a class="code" href="classstk_1_1Wurley.html#a6d79b2fbf627fa4f6c60f3c9d421c470" title="Class destructor.">~Wurley</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_1Wurley.html#af00b42ac4011cacc724bf4c9cf16fba4" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
||||
<a name="l00054"></a>00054
|
||||
<a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1Wurley.html#a3cca87fdccde2306beb49a19dd19c414" title="Start a note with the given frequency and amplitude.">noteOn</a>( StkFloat frequency, StkFloat amplitude );
|
||||
<a name="l00057"></a>00057
|
||||
<a name="l00059"></a>00059 StkFloat <a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00060"></a>00060
|
||||
<a name="l00062"></a>00062
|
||||
<a name="l00069"></a>00069 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 );
|
||||
<a name="l00070"></a>00070
|
||||
<a name="l00071"></a>00071 <span class="keyword">protected</span>:
|
||||
<a name="l00072"></a>00072
|
||||
<a name="l00073"></a>00073 };
|
||||
<a name="l00074"></a>00074
|
||||
<a name="l00075"></a><a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd">00075</a> <span class="keyword">inline</span> StkFloat <a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">Wurley :: tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> )
|
||||
<a name="l00076"></a>00076 {
|
||||
<a name="l00077"></a>00077 StkFloat temp, temp2;
|
||||
<a name="l00078"></a>00078
|
||||
<a name="l00079"></a>00079 temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
<a name="l00080"></a>00080 temp = temp * control1_;
|
||||
<a name="l00081"></a>00081
|
||||
<a name="l00082"></a>00082 waves_[0]->addPhaseOffset( temp );
|
||||
<a name="l00083"></a>00083 waves_[3]->addPhaseOffset( twozero_.<a class="code" href="classstk_1_1TwoZero.html#ae9808b0152902d0067ea24ccfba0b4ba" title="Return the last computed output value.">lastOut</a>() );
|
||||
<a name="l00084"></a>00084 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
<a name="l00085"></a>00085 twozero_.<a class="code" href="classstk_1_1TwoZero.html#acf92a66aeb2024cfcdb9d71ecadf3d82" title="Input one sample to the filter and return one output.">tick</a>(temp);
|
||||
<a name="l00086"></a>00086
|
||||
<a name="l00087"></a>00087 waves_[2]->addPhaseOffset( temp );
|
||||
<a name="l00088"></a>00088 temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]-><a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">tick</a>() * waves_[0]->tick();
|
||||
<a name="l00089"></a>00089 temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
<a name="l00090"></a>00090
|
||||
<a name="l00091"></a>00091 <span class="comment">// Calculate amplitude modulation and apply it to output.</span>
|
||||
<a name="l00092"></a>00092 temp2 = vibrato_.<a class="code" href="classstk_1_1SineWave.html#a31a55627bf8064919b5e063059260eda" title="Compute and return one output sample.">tick</a>() * modDepth_;
|
||||
<a name="l00093"></a>00093 temp = temp * (1.0 + temp2);
|
||||
<a name="l00094"></a>00094
|
||||
<a name="l00095"></a>00095 lastFrame_[0] = temp * 0.5;
|
||||
<a name="l00096"></a>00096 <span class="keywordflow">return</span> lastFrame_[0];
|
||||
<a name="l00097"></a>00097 }
|
||||
<a name="l00098"></a>00098
|
||||
<a name="l00099"></a><a class="code" href="classstk_1_1Wurley.html#a505f7e6499761f64d0cc4b6419d945c3">00099</a> <span class="keyword">inline</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">Wurley :: tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel )
|
||||
<a name="l00100"></a>00100 {
|
||||
<a name="l00101"></a>00101 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>();
|
||||
<a name="l00102"></a>00102 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
|
||||
<a name="l00103"></a>00103 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels ) {
|
||||
<a name="l00104"></a>00104 oStream_ << <span class="stringliteral">"Wurley::tick(): channel and StkFrames arguments are incompatible!"</span>;
|
||||
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
|
||||
<a name="l00106"></a>00106 }
|
||||
<a name="l00107"></a>00107 <span class="preprocessor">#endif</span>
|
||||
<a name="l00108"></a>00108 <span class="preprocessor"></span>
|
||||
<a name="l00109"></a>00109 StkFloat *samples = &frames[channel];
|
||||
<a name="l00110"></a>00110 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.<a class="code" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>() - nChannels;
|
||||
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ( nChannels == 1 ) {
|
||||
<a name="l00112"></a>00112 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop )
|
||||
<a name="l00113"></a>00113 *samples++ = <a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00114"></a>00114 }
|
||||
<a name="l00115"></a>00115 <span class="keywordflow">else</span> {
|
||||
<a name="l00116"></a>00116 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.<a class="code" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); i++, samples += hop ) {
|
||||
<a name="l00117"></a>00117 *samples++ = <a class="code" href="classstk_1_1Wurley.html#a2019cfe262eb755ac939c98bda0383bd" title="Compute and return one output sample.">tick</a>();
|
||||
<a name="l00118"></a>00118 <span class="keywordflow">for</span> ( j=1; j<nChannels; j++ )
|
||||
<a name="l00119"></a>00119 *samples++ = lastFrame_[j];
|
||||
<a name="l00120"></a>00120 }
|
||||
<a name="l00121"></a>00121 }
|
||||
<a name="l00122"></a>00122
|
||||
<a name="l00123"></a>00123 <span class="keywordflow">return</span> frames;
|
||||
<a name="l00124"></a>00124 }
|
||||
<a name="l00125"></a>00125
|
||||
<a name="l00126"></a>00126 } <span class="comment">// stk namespace</span>
|
||||
<a name="l00127"></a>00127
|
||||
<a name="l00128"></a>00128 <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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user