mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
96 lines
12 KiB
HTML
96 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"> <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="dir_c28bfe24b93fcab464ea84f988cb34ef.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#0d977aae11d75d0327057add00fa7f84" 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#0d977aae11d75d0327057add00fa7f84" 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#b6f0e0f9a5cc9c99627d0e12db007905" 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#5905940c0dd046a95ca9c2a1d72983de" 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#51688a9e84b2f9e5a9c4e62588b65c52">00052</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#51688a9e84b2f9e5a9c4e62588b65c52" 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#2c539902d697d0b87334ca7dc4f3ce69">00055</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#2c539902d697d0b87334ca7dc4f3ce69" 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#2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
|
|
<a name="l00056"></a>00056
|
|
<a name="l00058"></a>00058
|
|
<a name="l00062"></a><a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b">00062</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
|
|
<a name="l00063"></a>00063
|
|
<a name="l00065"></a>00065
|
|
<a name="l00069"></a><a class="code" href="classstk_1_1FileLoop.html#a1ac0c8d19f412f66f5fdb89854e2833">00069</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
|
|
<a name="l00070"></a>00070
|
|
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#d86d4f64c44a6f2488779fef24fc1ee7">00072</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#d86d4f64c44a6f2488779fef24fc1ee7" 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#05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
|
|
<a name="l00073"></a>00073
|
|
<a name="l00075"></a>00075
|
|
<a name="l00080"></a><a class="code" href="classstk_1_1FileLoop.html#a18006c800c7dac1ddd277c987fe0003">00080</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#a18006c800c7dac1ddd277c987fe0003" 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#4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
|
|
<a name="l00081"></a>00081
|
|
<a name="l00083"></a>00083
|
|
<a name="l00086"></a>00086 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
|
|
<a name="l00087"></a>00087
|
|
<a name="l00089"></a>00089
|
|
<a name="l00095"></a><a class="code" href="classstk_1_1FileLoop.html#ec8f94d8514b266acd83106ed0f24ead">00095</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#ec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-><a class="code" href="classstk_1_1FileLoop.html#13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
|
|
<a name="l00096"></a>00096
|
|
<a name="l00098"></a>00098 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
|
|
<a name="l00099"></a>00099
|
|
<a name="l00101"></a>00101
|
|
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
|
|
<a name="l00107"></a>00107
|
|
<a name="l00109"></a>00109
|
|
<a name="l00114"></a>00114 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#fe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
|
|
<a name="l00115"></a>00115
|
|
<a name="l00117"></a>00117
|
|
<a name="l00126"></a><a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd">00126</a> StkFloat <a class="code" href="classstk_1_1FileLoop.html#826b6dd0968c5abd1020a9fe629a4ffd" 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#826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
|
|
<a name="l00127"></a>00127
|
|
<a name="l00129"></a>00129
|
|
<a name="l00138"></a>00138 StkFloat <a class="code" href="classstk_1_1FileLoop.html#037b31918134ed1839a8b48de774ab95" 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="l00139"></a>00139
|
|
<a name="l00141"></a>00141
|
|
<a name="l00150"></a>00150 <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#037b31918134ed1839a8b48de774ab95" 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="l00151"></a>00151
|
|
<a name="l00152"></a>00152 <span class="keyword">protected</span>:
|
|
<a name="l00153"></a>00153
|
|
<a name="l00154"></a>00154 <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
|
|
<a name="l00155"></a>00155 StkFloat phaseOffset_;
|
|
<a name="l00156"></a>00156
|
|
<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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|