mirror of
https://github.com/thestk/stk
synced 2026-01-15 05:51:52 +00:00
214 lines
14 KiB
HTML
214 lines
14 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
|
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<CENTER>
|
|
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.5.8 -->
|
|
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1SineWave.html">SineWave</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>stk::SineWave Class Reference</h1><!-- doxytag: class="stk::SineWave" --><!-- doxytag: inherits="stk::Generator" -->STK sinusoid oscillator class.
|
|
<a href="#_details">More...</a>
|
|
<p>
|
|
<code>#include <<a class="el" href="SineWave_8h-source.html">SineWave.h</a>></code>
|
|
<p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for stk::SineWave:</div>
|
|
<div class="dynsection">
|
|
|
|
<p><center><img src="classstk_1_1SineWave.png" usemap="#stk::SineWave_map" border="0" alt=""></center>
|
|
<map name="stk::SineWave_map">
|
|
<area href="classstk_1_1Generator.html" alt="stk::Generator" shape="rect" coords="0,56,90,80">
|
|
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,90,24">
|
|
</map>
|
|
</div>
|
|
|
|
<p>
|
|
<a href="classstk_1_1SineWave-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td></td></tr>
|
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d25afe03871430c533986b0852e04c62"></a><!-- doxytag: member="stk::SineWave::SineWave" ref="d25afe03871430c533986b0852e04c62" args="(void)" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#d25afe03871430c533986b0852e04c62">SineWave</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e192f1813531f4b2ba933bcc5b288bfb"></a><!-- doxytag: member="stk::SineWave::~SineWave" ref="e192f1813531f4b2ba933bcc5b288bfb" args="(void)" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#e192f1813531f4b2ba933bcc5b288bfb">~SineWave</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class destructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="667b211ead65a23aa8ab89e4a9c9ae6c"></a><!-- doxytag: member="stk::SineWave::reset" ref="667b211ead65a23aa8ab89e4a9c9ae6c" args="(void)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#667b211ead65a23aa8ab89e4a9c9ae6c">reset</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Clear output and reset time pointer to zero. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#e69b232dd3a33963d25cf6215692d9d5">setRate</a> (StkFloat rate)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the data read rate in samples. The rate can be negative. <a href="#e69b232dd3a33963d25cf6215692d9d5"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#1047a43714bc2e40c7e31e8f7e34adbc">setFrequency</a> (StkFloat frequency)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Set the data interpolation rate based on a looping frequency. <a href="#1047a43714bc2e40c7e31e8f7e34adbc"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="dc8f03d5d81cfc24c20794033aad876f"></a><!-- doxytag: member="stk::SineWave::addTime" ref="dc8f03d5d81cfc24c20794033aad876f" args="(StkFloat time)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#dc8f03d5d81cfc24c20794033aad876f">addTime</a> (StkFloat time)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Increment the read pointer by <em>time</em> in samples, modulo the table size. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#62d69af61e6905ddda203756cd6e3516">addPhase</a> (StkFloat phase)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Increment the read pointer by a normalized <em>phase</em> value. <a href="#62d69af61e6905ddda203756cd6e3516"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#87bd4c92259b9b389f568f8d7cd7524f">addPhaseOffset</a> (StkFloat phaseOffset)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Add a normalized phase offset to the read pointer. <a href="#87bd4c92259b9b389f568f8d7cd7524f"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b788e787e5bb54445dd0769283567224"></a><!-- doxytag: member="stk::SineWave::lastOut" ref="b788e787e5bb54445dd0769283567224" args="(void) const " -->
|
|
StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#b788e787e5bb54445dd0769283567224">lastOut</a> (void) const </td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the last computed output value. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="31a55627bf8064919b5e063059260eda"></a><!-- doxytag: member="stk::SineWave::tick" ref="31a55627bf8064919b5e063059260eda" args="(void)" -->
|
|
StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#31a55627bf8064919b5e063059260eda">tick</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute and return one output sample. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1SineWave.html#f205d7029046af8a392341cabd58f9de">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &frames, unsigned int channel=0)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Fill a channel of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object with computed outputs. <a href="#f205d7029046af8a392341cabd58f9de"></a><br></td></tr>
|
|
</table>
|
|
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
STK sinusoid oscillator class.
|
|
<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>
|
|
The "table" length, set in <a class="el" href="SineWave_8h-source.html">SineWave.h</a>, is 2048 samples by default.<p>
|
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2007. <hr><h2>Member Function Documentation</h2>
|
|
<a class="anchor" name="e69b232dd3a33963d25cf6215692d9d5"></a><!-- doxytag: member="stk::SineWave::setRate" ref="e69b232dd3a33963d25cf6215692d9d5" args="(StkFloat rate)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::SineWave::setRate </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>rate</em> </td>
|
|
<td> ) </td>
|
|
<td><code> [inline]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Set the data read rate in samples. The rate can be negative.
|
|
<p>
|
|
If the rate value is negative, the data is read in reverse order.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="1047a43714bc2e40c7e31e8f7e34adbc"></a><!-- doxytag: member="stk::SineWave::setFrequency" ref="1047a43714bc2e40c7e31e8f7e34adbc" args="(StkFloat frequency)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::SineWave::setFrequency </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>frequency</em> </td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Set the data interpolation rate based on a looping frequency.
|
|
<p>
|
|
This function determines the interpolation rate based on the file size and the current <a class="el" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>. The <em>frequency</em> value corresponds to file cycles per second. The frequency can be negative, in which case the loop is read in reverse order.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="62d69af61e6905ddda203756cd6e3516"></a><!-- doxytag: member="stk::SineWave::addPhase" ref="62d69af61e6905ddda203756cd6e3516" args="(StkFloat phase)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::SineWave::addPhase </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>phase</em> </td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Increment the read pointer by a normalized <em>phase</em> value.
|
|
<p>
|
|
This function increments the read pointer by a normalized phase value, such that <em>phase</em> = 1.0 corresponds to a 360 degree phase shift. Positive or negative values are possible.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="87bd4c92259b9b389f568f8d7cd7524f"></a><!-- doxytag: member="stk::SineWave::addPhaseOffset" ref="87bd4c92259b9b389f568f8d7cd7524f" args="(StkFloat phaseOffset)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void stk::SineWave::addPhaseOffset </td>
|
|
<td>(</td>
|
|
<td class="paramtype">StkFloat </td>
|
|
<td class="paramname"> <em>phaseOffset</em> </td>
|
|
<td> ) </td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Add a normalized phase offset to the read pointer.
|
|
<p>
|
|
A <em>phaseOffset</em> = 1.0 corresponds to a 360 degree phase offset. Positive or negative values are possible.
|
|
</div>
|
|
</div><p>
|
|
<a class="anchor" name="f205d7029046af8a392341cabd58f9de"></a><!-- doxytag: member="stk::SineWave::tick" ref="f205d7029046af8a392341cabd58f9de" args="(StkFrames &frames, unsigned int channel=0)" -->
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & stk::SineWave::tick </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
|
|
<td class="paramname"> <em>frames</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">unsigned int </td>
|
|
<td class="paramname"> <em>channel</em> = <code>0</code></td><td> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td><td><code> [inline, virtual]</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="memdoc">
|
|
|
|
<p>
|
|
Fill a channel of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object with computed outputs.
|
|
<p>
|
|
The <code>channel</code> argument must be less than the number of channels in the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception.
|
|
<p>Implements <a class="el" href="classstk_1_1Generator.html#86bb0421223cf27e25704d5f27b97425">stk::Generator</a>.</p>
|
|
|
|
</div>
|
|
</div><p>
|
|
<hr>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="SineWave_8h-source.html">SineWave.h</a></ul>
|
|
</div>
|
|
<HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|