mirror of
https://github.com/thestk/stk
synced 2026-04-22 15:36:55 +00:00
Release 4.4.3 tarball
This commit is contained in:
committed by
Stephen Sinclair
parent
cfdfe7736a
commit
f13d5bb3cd
@@ -65,7 +65,7 @@ StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="
|
||||
<p>STK sinusoid oscillator class. </p>
|
||||
<p>This class computes and saves a static sine "table" that can be shared by multiple instances. It has an interface similar to the WaveLoop class but inherits from the <a class="el" href="classstk_1_1Generator.html" title="STK abstract unit generator parent class.">Generator</a> class. Output values are computed using linear interpolation.</p>
|
||||
<p>The "table" length, set in <a class="el" href="SineWave_8h_source.html">SineWave.h</a>, is 2048 samples by default.</p>
|
||||
<p>by Perry R. Cook and Gary P. Scavone, 1995 - 2007. </p>
|
||||
<p>by Perry R. Cook and Gary P. Scavone, 1995-2011. </p>
|
||||
<hr/><h2>Member Function Documentation</h2>
|
||||
<a class="anchor" id="ae69b232dd3a33963d25cf6215692d9d5"></a><!-- doxytag: member="stk::SineWave::setRate" ref="ae69b232dd3a33963d25cf6215692d9d5" args="(StkFloat rate)" -->
|
||||
<div class="memitem">
|
||||
@@ -86,6 +86,9 @@ StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="
|
||||
<p>Set the data read rate in samples. The rate can be negative. </p>
|
||||
<p>If the rate value is negative, the data is read in reverse order. </p>
|
||||
|
||||
<p><div class="fragment"><pre class="fragment"><a name="l00041"></a>00041 { rate_ = rate; };
|
||||
</pre></div></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a class="anchor" id="a1047a43714bc2e40c7e31e8f7e34adbc"></a><!-- doxytag: member="stk::SineWave::setFrequency" ref="a1047a43714bc2e40c7e31e8f7e34adbc" args="(StkFloat frequency)" -->
|
||||
@@ -181,6 +184,42 @@ StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="
|
||||
|
||||
<p>Implements <a class="el" href="classstk_1_1Generator.html#a86bb0421223cf27e25704d5f27b97425">stk::Generator</a>.</p>
|
||||
|
||||
<p><div class="fragment"><pre class="fragment"><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.channels() ) {
|
||||
<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.channels();
|
||||
<a name="l00133"></a>00133 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.frames(); 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 }
|
||||
</pre></div></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr/>The documentation for this class was generated from the following file:<ul>
|
||||
@@ -191,7 +230,7 @@ StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="
|
||||
|
||||
<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-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td>©1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
Reference in New Issue
Block a user