File: classstk_1_1FileWvIn.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 (417 lines) | stat: -rw-r--r-- 29,063 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
<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="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1FileWvIn.html">FileWvIn</a>
  </div>
<div class="contents">
<h1>stk::FileWvIn Class Reference</h1><!-- doxytag: class="stk::FileWvIn" --><!-- doxytag: inherits="stk::WvIn" -->
<p>STK audio file input class.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="FileWvIn_8h_source.html">FileWvIn.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for stk::FileWvIn:</div>
<div class="dynsection">
 <div class="center">
  <img src="classstk_1_1FileWvIn.png" usemap="#stk::FileWvIn_map" alt=""/>
  <map id="stk::FileWvIn_map" name="stk::FileWvIn_map">
<area href="classstk_1_1WvIn.html" alt="stk::WvIn" shape="rect" coords="0,56,82,80"/>
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,82,24"/>
<area href="classstk_1_1FileLoop.html" alt="stk::FileLoop" shape="rect" coords="0,168,82,192"/>
</map>
 </div>
</div>

<p><a href="classstk_1_1FileWvIn-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0562e85c4cb0d1565d9697da966add94"></a><!-- doxytag: member="stk::FileWvIn::FileWvIn" ref="a0562e85c4cb0d1565d9697da966add94" args="(unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#a0562e85c4cb0d1565d9697da966add94">FileWvIn</a> (unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#a01f985173b4d012fe5e9234134a71433">FileWvIn</a> (std::string fileName, bool raw=false, bool doNormalize=true, unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overloaded constructor for file input.  <a href="#a01f985173b4d012fe5e9234134a71433"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad63f10df8795ce5cb6348b0bb1ad884e"></a><!-- doxytag: member="stk::FileWvIn::~FileWvIn" ref="ad63f10df8795ce5cb6348b0bb1ad884e" args="(void)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ad63f10df8795ce5cb6348b0bb1ad884e">~FileWvIn</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Class destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#a7986664cd986cbacf4fb19e5c77deda1">openFile</a> (std::string fileName, bool raw=false, bool doNormalize=true)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Open the specified file and load its data.  <a href="#a7986664cd986cbacf4fb19e5c77deda1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae586a93b45a979881d9bd6fc1cb364cb"></a><!-- doxytag: member="stk::FileWvIn::closeFile" ref="ae586a93b45a979881d9bd6fc1cb364cb" args="(void)" -->
virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ae586a93b45a979881d9bd6fc1cb364cb">closeFile</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Close a file if one is open. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac7dfd47e46a083d434e63c9d1b8c3d28"></a><!-- doxytag: member="stk::FileWvIn::reset" ref="ac7dfd47e46a083d434e63c9d1b8c3d28" args="(void)" -->
virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ac7dfd47e46a083d434e63c9d1b8c3d28">reset</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Clear outputs and reset time (file) pointer to zero. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#aaecd1950fca3a5513e0efe4e86754b11">normalize</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Normalize data to a maximum of +-1.0.  <a href="#aaecd1950fca3a5513e0efe4e86754b11"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#a670b16fcbdd2a510706c23faeb00a1be">normalize</a> (StkFloat peak)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Normalize data to a maximum of <em>+-peak</em>.  <a href="#a670b16fcbdd2a510706c23faeb00a1be"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa8ef94c3ed01af0efc9e968f09207a26"></a><!-- doxytag: member="stk::FileWvIn::getSize" ref="aa8ef94c3ed01af0efc9e968f09207a26" args="(void) const " -->
virtual unsigned long&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#aa8ef94c3ed01af0efc9e968f09207a26">getSize</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the file size in sample frames. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#a867b7b7fdb60e5194e25d7a85a26ec0b">getFileRate</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the input file sample rate in Hz (not the data read rate).  <a href="#a867b7b7fdb60e5194e25d7a85a26ec0b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa45344366bca49f71c7153ac5b296e91"></a><!-- doxytag: member="stk::FileWvIn::isOpen" ref="aa45344366bca49f71c7153ac5b296e91" args="(void)" -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#aa45344366bca49f71c7153ac5b296e91">isOpen</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query whether a file is open. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aca9ad0c12af3323e7bbf877513b0d10b"></a><!-- doxytag: member="stk::FileWvIn::isFinished" ref="aca9ad0c12af3323e7bbf877513b0d10b" args="(void) const " -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b">isFinished</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query whether reading is complete. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#aacd97ad5f30f9cdc8201b4244aa69901">setRate</a> (StkFloat rate)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the data read rate in samples. The rate can be negative.  <a href="#aacd97ad5f30f9cdc8201b4244aa69901"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ab2ccf7cc65c36a1ecfbb3b7d5707ea48">addTime</a> (StkFloat time)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Increment the read pointer by <em>time</em> samples.  <a href="#ab2ccf7cc65c36a1ecfbb3b7d5707ea48"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#a129c1e0b51497e6b09ad6aa37ad4d969">setInterpolate</a> (bool doInterpolate)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Turn linear interpolation on/off.  <a href="#a129c1e0b51497e6b09ad6aa37ad4d969"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ad17c12e8d51f90f59f0d0c9f6d626608">lastOut</a> (unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the specified channel value of the last computed frame.  <a href="#ad17c12e8d51f90f59f0d0c9f6d626608"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual StkFloat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2">tick</a> (unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compute a sample frame and return the specified <code>channel</code> value.  <a href="#ada668a0bc0bf89e155ef341de00babc2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileWvIn.html#ad492f9becef5dfc9202a027bc5ad4580">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;frames)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Fill the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument with computed frames and return the same reference.  <a href="#ad492f9becef5dfc9202a027bc5ad4580"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>STK audio file input class. </p>
<p>This class inherits from <a class="el" href="classstk_1_1WvIn.html" title="STK audio input abstract base class.">WvIn</a>. It provides a "tick-level" interface to the <a class="el" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> class. It also provides variable-rate playback functionality. Audio file support is provided by the <a class="el" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> class. Linear interpolation is used for fractional read rates.</p>
<p><a class="el" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> supports multi-channel data. It is important to distinguish the <a class="el" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick()</a> method that computes a single frame (and returns only the specified sample of a multi-channel frame) from the overloaded one that takes an <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object for multi-channel and/or multi-frame data.</p>
<p><a class="el" href="classstk_1_1FileWvIn.html" title="STK audio file input class.">FileWvIn</a> will either load the entire content of an audio file into local memory or incrementally read file data from disk in chunks. This behavior is controlled by the optional constructor arguments <em>chunkThreshold</em> and <em>chunkSize</em>. File sizes greater than <em>chunkThreshold</em> (in sample frames) will be read incrementally in chunks of <em>chunkSize</em> each (also in sample frames).</p>
<p>When the file end is reached, subsequent calls to the <a class="el" href="classstk_1_1FileWvIn.html#ada668a0bc0bf89e155ef341de00babc2" title="Compute a sample frame and return the specified channel value.">tick()</a> functions return zeros and <a class="el" href="classstk_1_1FileWvIn.html#aca9ad0c12af3323e7bbf877513b0d10b" title="Query whether reading is complete.">isFinished()</a> returns <em>true</em>.</p>
<p>See the <a class="el" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> class for a description of the supported audio file formats.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995-2012. </p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a01f985173b4d012fe5e9234134a71433"></a><!-- doxytag: member="stk::FileWvIn::FileWvIn" ref="a01f985173b4d012fe5e9234134a71433" args="(std::string fileName, bool raw=false, bool doNormalize=true, unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">stk::FileWvIn::FileWvIn </td>
          <td>(</td>
          <td class="paramtype">std::string&nbsp;</td>
          <td class="paramname"> <em>fileName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>raw</em> = <code>false</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>doNormalize</em> = <code>true</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned long&nbsp;</td>
          <td class="paramname"> <em>chunkThreshold</em> = <code>1000000</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned long&nbsp;</td>
          <td class="paramname"> <em>chunkSize</em> = <code>1024</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Overloaded constructor for file input. </p>
<p>An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if the file is not found, its format is unknown, or a read error occurs. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a7986664cd986cbacf4fb19e5c77deda1"></a><!-- doxytag: member="stk::FileWvIn::openFile" ref="a7986664cd986cbacf4fb19e5c77deda1" args="(std::string fileName, bool raw=false, bool doNormalize=true)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void stk::FileWvIn::openFile </td>
          <td>(</td>
          <td class="paramtype">std::string&nbsp;</td>
          <td class="paramname"> <em>fileName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>raw</em> = <code>false</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>doNormalize</em> = <code>true</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Open the specified file and load its data. </p>
<p>Data from a previously opened file will be overwritten by this function. An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if the file is not found, its format is unknown, or a read error occurs. If the file data is to be loaded incrementally from disk and normalization is specified, a scaling will be applied with respect to fixed-point limits. If the data format is floating-point, no scaling is performed. </p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a5905940c0dd046a95ca9c2a1d72983de">stk::FileLoop</a>.</p>

</div>
</div>
<a class="anchor" id="aaecd1950fca3a5513e0efe4e86754b11"></a><!-- doxytag: member="stk::FileWvIn::normalize" ref="aaecd1950fca3a5513e0efe4e86754b11" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void stk::FileWvIn::normalize </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Normalize data to a maximum of +-1.0. </p>
<p>This function has no effect when data is incrementally loaded from disk. </p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a7c4a3d5c427154bf653f86a53e900b8b">stk::FileLoop</a>.</p>

</div>
</div>
<a class="anchor" id="a670b16fcbdd2a510706c23faeb00a1be"></a><!-- doxytag: member="stk::FileWvIn::normalize" ref="a670b16fcbdd2a510706c23faeb00a1be" args="(StkFloat peak)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void stk::FileWvIn::normalize </td>
          <td>(</td>
          <td class="paramtype">StkFloat&nbsp;</td>
          <td class="paramname"> <em>peak</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Normalize data to a maximum of <em>+-peak</em>. </p>
<p>This function has no effect when data is incrementally loaded from disk. </p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#aa1ac0c8d19f412f66f5fdb89854e2833">stk::FileLoop</a>.</p>

</div>
</div>
<a class="anchor" id="a867b7b7fdb60e5194e25d7a85a26ec0b"></a><!-- doxytag: member="stk::FileWvIn::getFileRate" ref="a867b7b7fdb60e5194e25d7a85a26ec0b" args="(void) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual StkFloat stk::FileWvIn::getFileRate </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the input file sample rate in Hz (not the data read rate). </p>
<p>WAV, SND, and AIF formatted files specify a sample rate in their headers. STK RAW files have a sample rate of 22050 Hz by definition. MAT-files are assumed to have a rate of 44100 Hz. </p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#aa18006c800c7dac1ddd277c987fe0003">stk::FileLoop</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00100"></a>00100 { <span class="keywordflow">return</span> data_.dataRate(); };
</pre></div></p>

</div>
</div>
<a class="anchor" id="aacd97ad5f30f9cdc8201b4244aa69901"></a><!-- doxytag: member="stk::FileWvIn::setRate" ref="aacd97ad5f30f9cdc8201b4244aa69901" args="(StkFloat rate)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void stk::FileWvIn::setRate </td>
          <td>(</td>
          <td class="paramtype">StkFloat&nbsp;</td>
          <td class="paramname"> <em>rate</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the data read rate in samples. The rate can be negative. </p>
<p>If the rate value is negative, the data is read in reverse order. </p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a13e1f693bc8a29d9051a400087347a3c">stk::FileLoop</a>.</p>

</div>
</div>
<a class="anchor" id="ab2ccf7cc65c36a1ecfbb3b7d5707ea48"></a><!-- doxytag: member="stk::FileWvIn::addTime" ref="ab2ccf7cc65c36a1ecfbb3b7d5707ea48" args="(StkFloat time)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual void stk::FileWvIn::addTime </td>
          <td>(</td>
          <td class="paramtype">StkFloat&nbsp;</td>
          <td class="paramname"> <em>time</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Increment the read pointer by <em>time</em> samples. </p>
<p>Note that this function will not modify the interpolation flag status. </p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a1986db79fd04b93f4d10b8cdf75bca34">stk::FileLoop</a>.</p>

</div>
</div>
<a class="anchor" id="a129c1e0b51497e6b09ad6aa37ad4d969"></a><!-- doxytag: member="stk::FileWvIn::setInterpolate" ref="a129c1e0b51497e6b09ad6aa37ad4d969" args="(bool doInterpolate)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stk::FileWvIn::setInterpolate </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>doInterpolate</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Turn linear interpolation on/off. </p>
<p>Interpolation is automatically off when the read rate is an integer value. If interpolation is turned off for a fractional rate, the time index is truncated to an integer value. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00127"></a>00127 { interpolate_ = doInterpolate; };
</pre></div></p>

</div>
</div>
<a class="anchor" id="ad17c12e8d51f90f59f0d0c9f6d626608"></a><!-- doxytag: member="stk::FileWvIn::lastOut" ref="ad17c12e8d51f90f59f0d0c9f6d626608" args="(unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StkFloat stk::FileWvIn::lastOut </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>channel</em> = <code>0</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the specified channel value of the last computed frame. </p>
<p>If no file is loaded, the returned value is 0.0. The <code>channel</code> argument must be less than the number of output channels, which can be determined with the <a class="el" href="classstk_1_1WvIn.html#a2ce05e5c8087e483236961335e8abf04" title="Return the number of audio channels in the data or stream.">channelsOut()</a> function (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>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classstk_1_1WvIn.html#a3ab86e33eff9f962c9ef7b41e3ccb77e" title="Return an StkFrames reference to the last computed sample frame.">lastFrame()</a> </dd></dl>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a826b6dd0968c5abd1020a9fe629a4ffd">stk::FileLoop</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00182"></a>00182 {
<a name="l00183"></a>00183 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00184"></a>00184 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( channel &gt;= data_.channels() ) {
<a name="l00185"></a>00185     oStream_ &lt;&lt; <span class="stringliteral">&quot;FileWvIn::lastOut(): channel argument and soundfile data are incompatible!&quot;</span>;
<a name="l00186"></a>00186     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">handleError</a>( StkError::FUNCTION_ARGUMENT );
<a name="l00187"></a>00187   }
<a name="l00188"></a>00188 <span class="preprocessor">#endif</span>
<a name="l00189"></a>00189 <span class="preprocessor"></span>
<a name="l00190"></a>00190   <span class="keywordflow">if</span> ( finished_ ) <span class="keywordflow">return</span> 0.0;
<a name="l00191"></a>00191   <span class="keywordflow">return</span> lastFrame_[channel];
<a name="l00192"></a>00192 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ada668a0bc0bf89e155ef341de00babc2"></a><!-- doxytag: member="stk::FileWvIn::tick" ref="ada668a0bc0bf89e155ef341de00babc2" args="(unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual StkFloat stk::FileWvIn::tick </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>channel</em> = <code>0</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Compute a sample frame and return the specified <code>channel</code> value. </p>
<p>For multi-channel files, use the <a class="el" href="classstk_1_1WvIn.html#a3ab86e33eff9f962c9ef7b41e3ccb77e" title="Return an StkFrames reference to the last computed sample frame.">lastFrame()</a> function to get all values from the computed frame. If no file data is loaded, the returned value is 0.0. The <code>channel</code> argument must be less than the number of channels in the file data (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>

<p>Implements <a class="el" href="classstk_1_1WvIn.html#a0eda243730408a434856fffed776931e">stk::WvIn</a>.</p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a037b31918134ed1839a8b48de774ab95">stk::FileLoop</a>.</p>

</div>
</div>
<a class="anchor" id="ad492f9becef5dfc9202a027bc5ad4580"></a><!-- doxytag: member="stk::FileWvIn::tick" ref="ad492f9becef5dfc9202a027bc5ad4580" args="(StkFrames &amp;frames)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="classstk_1_1StkFrames.html">StkFrames</a>&amp; stk::FileWvIn::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>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Fill the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument with computed frames and return the same reference. </p>
<p>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 must equal the number of channels in the file data. However, this is only checked if _STK_DEBUG_ is defined during compilation, in which case an incompatibility will trigger an <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> exception. If no file data is loaded, the function does nothing (a warning will be issued if _STK_DEBUG_ is defined during compilation). </p>

<p>Implements <a class="el" href="classstk_1_1WvIn.html#a76718752b0cc1ab767ba4e70d72b9453">stk::WvIn</a>.</p>

<p>Reimplemented in <a class="el" href="classstk_1_1FileLoop.html#a3d91eb1f9c76d1bf6461ce2e4a3f8983">stk::FileLoop</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="FileWvIn_8h_source.html">FileWvIn.h</a></li>
</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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>

</BODY>
</HTML>