mirror of
https://github.com/thestk/stk
synced 2026-01-13 04:51:53 +00:00
90 lines
8.1 KiB
HTML
90 lines
8.1 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.6.2 -->
|
|
<div class="navpath"><a class="el" href="dir_ca1e4533604ab7cb0cdaaff730a9c38f.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>WvOut.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_WVOUT_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_WVOUT_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="l00020"></a>00020 <span class="comment">/***************************************************/</span>
|
|
<a name="l00021"></a>00021
|
|
<a name="l00022"></a><a class="code" href="classstk_1_1WvOut.html">00022</a> <span class="keyword">class </span><a class="code" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">WvOut</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="l00025"></a>00025
|
|
<a name="l00027"></a><a class="code" href="classstk_1_1WvOut.html#a4337bc4efb010ce57af3543dc5ed6f66">00027</a> <a class="code" href="classstk_1_1WvOut.html#a4337bc4efb010ce57af3543dc5ed6f66" title="Default constructor.">WvOut</a>( <span class="keywordtype">void</span> ) : frameCounter_(0), clipping_(false) {};
|
|
<a name="l00028"></a>00028
|
|
<a name="l00030"></a><a class="code" href="classstk_1_1WvOut.html#aa0ef107e58e0b470cbb47de292251a5e">00030</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1WvOut.html#aa0ef107e58e0b470cbb47de292251a5e" title="Return the number of sample frames output.">getFrameCount</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> frameCounter_; };
|
|
<a name="l00031"></a>00031
|
|
<a name="l00033"></a><a class="code" href="classstk_1_1WvOut.html#aca11b8991f281beb2b1c4d562c7ff43b">00033</a> StkFloat <a class="code" href="classstk_1_1WvOut.html#aca11b8991f281beb2b1c4d562c7ff43b" title="Return the number of seconds of data output.">getTime</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (StkFloat) frameCounter_ / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>(); };
|
|
<a name="l00034"></a>00034
|
|
<a name="l00036"></a><a class="code" href="classstk_1_1WvOut.html#aed503fe979c33eb8240901f005cb48d5">00036</a> <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1WvOut.html#aed503fe979c33eb8240901f005cb48d5" title="Returns true if clipping has been detected during output since instantiation or the...">clipStatus</a>( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> clipping_; };
|
|
<a name="l00037"></a>00037
|
|
<a name="l00039"></a><a class="code" href="classstk_1_1WvOut.html#a73f7143c2a574afd0a6c7934a92e7bf3">00039</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1WvOut.html#a73f7143c2a574afd0a6c7934a92e7bf3" title="Reset the clipping status to false.">resetClipStatus</a>( <span class="keywordtype">void</span> ) { clipping_ = <span class="keyword">false</span>; };
|
|
<a name="l00040"></a>00040
|
|
<a name="l00042"></a>00042
|
|
<a name="l00045"></a>00045 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1WvOut.html#a7fe517928a0043353ebc2a852b49953c" title="Output a single sample to all channels in a sample frame.">tick</a>( <span class="keyword">const</span> StkFloat sample ) = 0;
|
|
<a name="l00046"></a>00046
|
|
<a name="l00048"></a>00048 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1WvOut.html#a7fe517928a0043353ebc2a852b49953c" 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 ) = 0;
|
|
<a name="l00049"></a>00049
|
|
<a name="l00050"></a>00050 <span class="keyword">protected</span>:
|
|
<a name="l00051"></a>00051
|
|
<a name="l00052"></a>00052 <span class="comment">// Check for sample clipping and clamp.</span>
|
|
<a name="l00053"></a>00053 StkFloat& clipTest( StkFloat& sample );
|
|
<a name="l00054"></a>00054
|
|
<a name="l00055"></a>00055 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data_;
|
|
<a name="l00056"></a>00056 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;
|
|
<a name="l00057"></a>00057 <span class="keywordtype">bool</span> clipping_;
|
|
<a name="l00058"></a>00058
|
|
<a name="l00059"></a>00059 };
|
|
<a name="l00060"></a>00060
|
|
<a name="l00061"></a>00061 <span class="keyword">inline</span> StkFloat& WvOut :: clipTest( StkFloat& sample )
|
|
<a name="l00062"></a>00062 {
|
|
<a name="l00063"></a>00063 <span class="keywordtype">bool</span> clip = <span class="keyword">false</span>;
|
|
<a name="l00064"></a>00064 <span class="keywordflow">if</span> ( sample > 1.0 ) {
|
|
<a name="l00065"></a>00065 sample = 1.0;
|
|
<a name="l00066"></a>00066 clip = <span class="keyword">true</span>;
|
|
<a name="l00067"></a>00067 }
|
|
<a name="l00068"></a>00068 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( sample < -1.0 ) {
|
|
<a name="l00069"></a>00069 sample = -1.0;
|
|
<a name="l00070"></a>00070 clip = <span class="keyword">true</span>;
|
|
<a name="l00071"></a>00071 }
|
|
<a name="l00072"></a>00072
|
|
<a name="l00073"></a>00073 <span class="keywordflow">if</span> ( clip == <span class="keyword">true</span> && clipping_ == <span class="keyword">false</span> ) {
|
|
<a name="l00074"></a>00074 <span class="comment">// First occurrence of clipping since instantiation or reset.</span>
|
|
<a name="l00075"></a>00075 clipping_ = <span class="keyword">true</span>;
|
|
<a name="l00076"></a>00076 errorString_ << <span class="stringliteral">"WvOut: data value(s) outside +-1.0 detected ... clamping at outer bound!"</span>;
|
|
<a name="l00077"></a>00077 <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="l00078"></a>00078 }
|
|
<a name="l00079"></a>00079
|
|
<a name="l00080"></a>00080 <span class="keywordflow">return</span> sample;
|
|
<a name="l00081"></a>00081 }
|
|
<a name="l00082"></a>00082
|
|
<a name="l00083"></a>00083 } <span class="comment">// stk namespace</span>
|
|
<a name="l00084"></a>00084
|
|
<a name="l00085"></a>00085 <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-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|