File: FileLoop_8h_source.html

package info (click to toggle)
stk 4.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 24,856 kB
  • sloc: cpp: 33,976; tcl: 2,375; sh: 2,319; ansic: 163; perl: 114; makefile: 37
file content (97 lines) | stat: -rw-r--r-- 12,556 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<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.6.2 -->
  <div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.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 &quot;FileWvIn.h&quot;</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#a0d977aae11d75d0327057add00fa7f84" 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#a0d977aae11d75d0327057add00fa7f84" 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#ab6f0e0f9a5cc9c99627d0e12db007905" 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#a5905940c0dd046a95ca9c2a1d72983de" 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#a51688a9e84b2f9e5a9c4e62588b65c52">00052</a>   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" title="Close a file if one is open.">closeFile</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a51688a9e84b2f9e5a9c4e62588b65c52" 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#a2c539902d697d0b87334ca7dc4f3ce69">00055</a>   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a2c539902d697d0b87334ca7dc4f3ce69" 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#a2c539902d697d0b87334ca7dc4f3ce69" title="Clear outputs and reset time (file) pointer to zero.">FileWvIn::reset</a>(); };
<a name="l00056"></a>00056 
<a name="l00058"></a><a class="code" href="classstk_1_1FileLoop.html#a9f3c514ce166068197684a21d31c3a76">00058</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileLoop.html#a9f3c514ce166068197684a21d31c3a76" title="Return the number of audio channels in the data or stream.">channelsOut</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#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels</a>(); };
<a name="l00059"></a>00059 
<a name="l00061"></a>00061 
<a name="l00065"></a><a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b">00065</a>   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">normalize</a>( <span class="keywordtype">void</span> ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( 1.0 ); };
<a name="l00066"></a>00066 
<a name="l00068"></a>00068 
<a name="l00072"></a><a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833">00072</a>   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833" title="Normalize data to a maximum of +-peak.">normalize</a>( StkFloat peak ) { <a class="code" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b" title="Normalize data to a maximum of +-1.0.">FileWvIn::normalize</a>( peak ); };
<a name="l00073"></a>00073 
<a name="l00075"></a><a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7">00075</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileLoop.html#ad86d4f64c44a6f2488779fef24fc1ee7" 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#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames</a>(); };
<a name="l00076"></a>00076 
<a name="l00078"></a>00078 
<a name="l00083"></a><a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003">00083</a>   StkFloat <a class="code" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003" 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#a4dbbcbdc8db39a803e0861976f7f3522" title="Return the sample rate associated with the StkFrames data.">dataRate</a>(); };
<a name="l00084"></a>00084 
<a name="l00086"></a>00086 
<a name="l00089"></a>00089   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( StkFloat rate );
<a name="l00090"></a>00090 
<a name="l00092"></a>00092 
<a name="l00098"></a><a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead">00098</a>   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#aec8f94d8514b266acd83106ed0f24ead" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( StkFloat frequency ) { this-&gt;<a class="code" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c" title="Set the data read rate in samples. The rate can be negative.">setRate</a>( file_.<a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>() * frequency / <a class="code" href="classstk_1_1Stk.html#a5fbe37000a611ce56075ee7d8936472d" title="Static method that returns the current STK sample rate.">Stk::sampleRate</a>() ); };
<a name="l00099"></a>00099 
<a name="l00101"></a>00101   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a1986db79fd04b93f4d10b8cdf75bca34" title="Increment the read pointer by time samples, modulo file size.">addTime</a>( StkFloat time );
<a name="l00102"></a>00102 
<a name="l00104"></a>00104 
<a name="l00109"></a>00109   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#a8e24d6f9292a9443fbc21e4e8797f482" title="Increment current read pointer by angle, relative to a looping frequency.">addPhase</a>( StkFloat angle );
<a name="l00110"></a>00110 
<a name="l00112"></a>00112 
<a name="l00117"></a>00117   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileLoop.html#afe462794ba202dd879d29c39e76ae111" title="Add a phase offset to the current read pointer.">addPhaseOffset</a>( StkFloat angle );
<a name="l00118"></a>00118 
<a name="l00120"></a>00120 
<a name="l00129"></a><a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd">00129</a>   StkFloat <a class="code" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd" 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#a826b6dd0968c5abd1020a9fe629a4ffd" title="Return the specified channel value of the last computed frame.">FileWvIn::lastOut</a>( channel ); };
<a name="l00130"></a>00130 
<a name="l00132"></a>00132 
<a name="l00141"></a>00141   StkFloat <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" 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="l00142"></a>00142 
<a name="l00144"></a>00144 
<a name="l00153"></a>00153   <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>&amp; <a class="code" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95" 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>&amp; frames );
<a name="l00154"></a>00154 
<a name="l00155"></a>00155  <span class="keyword">protected</span>:
<a name="l00156"></a>00156 
<a name="l00157"></a>00157   <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> firstFrame_;
<a name="l00158"></a>00158   StkFloat phaseOffset_;
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 };
<a name="l00161"></a>00161 
<a name="l00162"></a>00162 } <span class="comment">// stk namespace</span>
<a name="l00163"></a>00163 
<a name="l00164"></a>00164 <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>&copy;1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>

</BODY>
</HTML>