Files
stk/doc/html/classstk_1_1Blit.html
2013-09-29 23:44:33 +02:00

189 lines
12 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"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="faq.html">FAQ</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1Blit.html">Blit</a>
</div>
<div class="contents">
<h1>stk::Blit Class Reference</h1><!-- doxytag: class="stk::Blit" --><!-- doxytag: inherits="stk::Generator" -->STK band-limited impulse train class.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="Blit_8h-source.html">Blit.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for stk::Blit:</div>
<div class="dynsection">
<p><center><img src="classstk_1_1Blit.png" usemap="#stk::Blit_map" border="0" alt=""></center>
<map name="stk::Blit_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_1Blit-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="63c5e6dca28aa3b3c01808e049f3da33"></a><!-- doxytag: member="stk::Blit::Blit" ref="63c5e6dca28aa3b3c01808e049f3da33" args="(StkFloat frequency=220.0)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#63c5e6dca28aa3b3c01808e049f3da33">Blit</a> (StkFloat frequency=220.0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor that initializes BLIT frequency to 220 Hz. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bed25206cc6cdb5fa8d667e7db0056a9"></a><!-- doxytag: member="stk::Blit::~Blit" ref="bed25206cc6cdb5fa8d667e7db0056a9" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#bed25206cc6cdb5fa8d667e7db0056a9">~Blit</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Class destructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bbe50319cd6ed762c15e148a8abb4920"></a><!-- doxytag: member="stk::Blit::reset" ref="bbe50319cd6ed762c15e148a8abb4920" args="()" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#bbe50319cd6ed762c15e148a8abb4920">reset</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resets the oscillator state and phase to 0. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#58e2197cedfc366145b729256bf365cb">setPhase</a> (StkFloat phase)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the phase of the signal. <a href="#58e2197cedfc366145b729256bf365cb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#01fb40970e8905e47b7f39a1fb01589f">getPhase</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the current phase of the signal. <a href="#01fb40970e8905e47b7f39a1fb01589f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5571562e489947c4beccc206ecccfbdd"></a><!-- doxytag: member="stk::Blit::setFrequency" ref="5571562e489947c4beccc206ecccfbdd" args="(StkFloat frequency)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#5571562e489947c4beccc206ecccfbdd">setFrequency</a> (StkFloat frequency)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the impulse train rate in terms of a frequency in Hz. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#5a1fd506ab12ae614afaf0e402d24d30">setHarmonics</a> (unsigned int nHarmonics=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the number of harmonics generated in the signal. <a href="#5a1fd506ab12ae614afaf0e402d24d30"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="530af82a27731734af4f4b58bce283de"></a><!-- doxytag: member="stk::Blit::lastOut" ref="530af82a27731734af4f4b58bce283de" args="(void) const " -->
StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#530af82a27731734af4f4b58bce283de">lastOut</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</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="528b8dc95499b11d6173cf065d62c717"></a><!-- doxytag: member="stk::Blit::tick" ref="528b8dc95499b11d6173cf065d62c717" args="(void)" -->
StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#528b8dc95499b11d6173cf065d62c717">tick</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</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> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Blit.html#20a3634131ff890641931c1d04df19ad">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;frames, unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</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="#20a3634131ff890641931c1d04df19ad"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
STK band-limited impulse train class.
<p>
This class generates a band-limited impulse train using a closed-form algorithm reported by Stilson and Smith in "Alias-Free Digital Synthesis of Classic Analog Waveforms", 1996. The user can specify both the fundamental frequency of the impulse train and the number of harmonics contained in the resulting signal.<p>
The signal is normalized so that the peak value is +/-1.0.<p>
If nHarmonics is 0, then the signal will contain all harmonics up to half the sample rate. Note, however, that this setting may produce aliasing in the signal when the frequency is changing (no automatic modification of the number of harmonics is performed by the <a class="el" href="classstk_1_1Blit.html#5571562e489947c4beccc206ecccfbdd" title="Set the impulse train rate in terms of a frequency in Hz.">setFrequency()</a> function).<p>
Original code by Robin Davies, 2005. Revisions by Gary Scavone for STK, 2005. <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="58e2197cedfc366145b729256bf365cb"></a><!-- doxytag: member="stk::Blit::setPhase" ref="58e2197cedfc366145b729256bf365cb" args="(StkFloat phase)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Blit::setPhase </td>
<td>(</td>
<td class="paramtype">StkFloat&nbsp;</td>
<td class="paramname"> <em>phase</em> </td>
<td>&nbsp;)&nbsp;</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set the phase of the signal.
<p>
Set the phase of the signal, in the range 0 to 1.
</div>
</div><p>
<a class="anchor" name="01fb40970e8905e47b7f39a1fb01589f"></a><!-- doxytag: member="stk::Blit::getPhase" ref="01fb40970e8905e47b7f39a1fb01589f" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">StkFloat stk::Blit::getPhase </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Get the current phase of the signal.
<p>
Get the phase of the signal, in the range [0 to 1.0).
</div>
</div><p>
<a class="anchor" name="5a1fd506ab12ae614afaf0e402d24d30"></a><!-- doxytag: member="stk::Blit::setHarmonics" ref="5a1fd506ab12ae614afaf0e402d24d30" args="(unsigned int nHarmonics=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Blit::setHarmonics </td>
<td>(</td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>nHarmonics</em> = <code>0</code> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Set the number of harmonics generated in the signal.
<p>
This function sets the number of harmonics contained in the resulting signal. It is equivalent to (2 * M) + 1 in the BLIT algorithm. The default value of 0 sets the algorithm for maximum harmonic content (harmonics up to half the sample rate). This parameter is not checked against the current sample rate and fundamental frequency. Thus, aliasing can result if one or more harmonics for a given fundamental frequency exceeds fs / 2. This behavior was chosen over the potentially more problematic solution of automatically modifying the M parameter, which can produce audible clicks in the signal.
</div>
</div><p>
<a class="anchor" name="20a3634131ff890641931c1d04df19ad"></a><!-- doxytag: member="stk::Blit::tick" ref="20a3634131ff890641931c1d04df19ad" args="(StkFrames &amp;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> &amp; stk::Blit::tick </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
<td class="paramname"> <em>frames</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int&nbsp;</td>
<td class="paramname"> <em>channel</em> = <code>0</code></td><td>&nbsp;</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="Blit_8h-source.html">Blit.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>&copy;1995-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>