File: classstk_1_1StkFrames.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 (461 lines) | stat: -rw-r--r-- 32,191 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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<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_1StkFrames.html">StkFrames</a>
  </div>
<div class="contents">
<h1>stk::StkFrames Class Reference</h1><!-- doxytag: class="stk::StkFrames" -->
<p>An STK class to handle vectorized audio data.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="Stk_8h_source.html">Stk.h</a>&gt;</code></p>

<p><a href="classstk_1_1StkFrames-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="aa9ad14889de633ba4269f1330be8bedf"></a><!-- doxytag: member="stk::StkFrames::StkFrames" ref="aa9ad14889de633ba4269f1330be8bedf" args="(unsigned int nFrames=0, unsigned int nChannels=0)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#aa9ad14889de633ba4269f1330be8bedf">StkFrames</a> (unsigned int nFrames=0, unsigned int nChannels=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The default constructor initializes the frame data structure to size zero. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac48aabe6cf029c06d2aa8a5fedf3621e"></a><!-- doxytag: member="stk::StkFrames::StkFrames" ref="ac48aabe6cf029c06d2aa8a5fedf3621e" args="(const StkFloat &amp;value, unsigned int nFrames, unsigned int nChannels)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#ac48aabe6cf029c06d2aa8a5fedf3621e">StkFrames</a> (const StkFloat &amp;value, unsigned int nFrames, unsigned int nChannels)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overloaded constructor that initializes the frame data to the specified size with <code>value</code>. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3fa9a0a175de2b18e75d9b68a6387895"></a><!-- doxytag: member="stk::StkFrames::~StkFrames" ref="a3fa9a0a175de2b18e75d9b68a6387895" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#a3fa9a0a175de2b18e75d9b68a6387895">~StkFrames</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#a8ed9cc0a4309f786cfe36da9e901fde9">operator[]</a> (size_t n)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Subscript operator that returns a reference to element <code>n</code> of self.  <a href="#a8ed9cc0a4309f786cfe36da9e901fde9"></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_1StkFrames.html#a2d1c8a2b32725ca72e0f3256f9cd8cb6">operator[]</a> (size_t n) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Subscript operator that returns the value at element <code>n</code> of self.  <a href="#a2d1c8a2b32725ca72e0f3256f9cd8cb6"></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_1StkFrames.html#a0f6a81d36a8905d782b283b9a05893e6">operator+=</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;f)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assignment by sum operator into self.  <a href="#a0f6a81d36a8905d782b283b9a05893e6"></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_1StkFrames.html#a049cbfd10908f754a7c48c1dd0da21e0">operator*=</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;f)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assignment by product operator into self.  <a href="#a049cbfd10908f754a7c48c1dd0da21e0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#a813632277bf0c432bcf81136ccdbbec1">operator()</a> (size_t frame, unsigned int channel)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Channel / frame subscript operator that returns a reference.  <a href="#a813632277bf0c432bcf81136ccdbbec1"></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_1StkFrames.html#a93e7e4c30affc29d0cdc98e7514188de">operator()</a> (size_t frame, unsigned int channel) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Channel / frame subscript operator that returns a value.  <a href="#a93e7e4c30affc29d0cdc98e7514188de"></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_1StkFrames.html#a4f9402d9be28da418f630b4261b9b386">interpolate</a> (StkFloat frame, unsigned int channel=0) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return an interpolated value at the fractional frame index and channel.  <a href="#a4f9402d9be28da418f630b4261b9b386"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5c41aae98f77487c004085912d1f8f79"></a><!-- doxytag: member="stk::StkFrames::size" ref="a5c41aae98f77487c004085912d1f8f79" args="() const " -->
size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#a5c41aae98f77487c004085912d1f8f79">size</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the total number of audio samples represented by the object. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac6652950830fe907f9158ee891560253"></a><!-- doxytag: member="stk::StkFrames::empty" ref="ac6652950830fe907f9158ee891560253" args="() const " -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#ac6652950830fe907f9158ee891560253">empty</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns <em>true</em> if the object size is zero and <em>false</em> otherwise. <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_1StkFrames.html#a386e1b86cf48f7a8117313f9e41fc0fe">resize</a> (size_t nFrames, unsigned int nChannels=1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resize self to represent the specified number of channels and frames.  <a href="#a386e1b86cf48f7a8117313f9e41fc0fe"></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_1StkFrames.html#a57ecf6563fdd2d3732aa9de2692af32e">resize</a> (size_t nFrames, unsigned int nChannels, StkFloat value)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resize self to represent the specified number of channels and frames and perform element initialization.  <a href="#a57ecf6563fdd2d3732aa9de2692af32e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aec7ef9c46675a24111aa6e2fda3ba870"></a><!-- doxytag: member="stk::StkFrames::channels" ref="aec7ef9c46675a24111aa6e2fda3ba870" args="(void) const " -->
unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870">channels</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the number of channels represented by the data. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a05b1ab6fa750a8221a7d65c30e0cdab9"></a><!-- doxytag: member="stk::StkFrames::frames" ref="a05b1ab6fa750a8221a7d65c30e0cdab9" args="(void) const " -->
unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9">frames</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the number of sample frames represented by the data. <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_1StkFrames.html#ad528b1c8ea2866570e7d9c2bac0e8b40">setDataRate</a> (StkFloat rate)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the sample rate associated with the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data.  <a href="#ad528b1c8ea2866570e7d9c2bac0e8b40"></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_1StkFrames.html#a4dbbcbdc8db39a803e0861976f7f3522">dataRate</a> (void) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the sample rate associated with the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data.  <a href="#a4dbbcbdc8db39a803e0861976f7f3522"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>An STK class to handle vectorized audio data. </p>
<p>This class can hold single- or multi-channel audio data. The data type is always StkFloat and the channel format is always interleaved. In an effort to maintain efficiency, no out-of-bounds checks are performed in this class unless _STK_DEBUG_ is defined.</p>
<p>Internally, the data is stored in a one-dimensional C array. An indexing operator is available to set and retrieve data values. Alternately, one can use pointers to access the data, using the index operator to get an address for a particular location in the data:</p>
<p>StkFloat* ptr = &amp;myStkFrames[0];</p>
<p>Note that this class can also be used as a table with interpolating lookup.</p>
<p>Possible future improvements in this class could include functions to convert to and return other data types.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995-2012. </p>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a8ed9cc0a4309f786cfe36da9e901fde9"></a><!-- doxytag: member="stk::StkFrames::operator[]" ref="a8ed9cc0a4309f786cfe36da9e901fde9" args="(size_t n)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StkFloat &amp; stk::StkFrames::operator[] </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>n</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Subscript operator that returns a reference to element <code>n</code> of self. </p>
<p>The result can be used as an lvalue. This reference is valid until the resize function is called or the array is destroyed. The index <code>n</code> must be between 0 and size less one. No range checking is performed unless _STK_DEBUG_ is defined. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00413"></a>00413 {
<a name="l00414"></a>00414 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00415"></a>00415 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( n &gt;= size_ ) {
<a name="l00416"></a>00416     std::ostringstream error;
<a name="l00417"></a>00417     error &lt;&lt; <span class="stringliteral">&quot;StkFrames::operator[]: invalid index (&quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot;) value!&quot;</span>;
<a name="l00418"></a>00418     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
<a name="l00419"></a>00419   }
<a name="l00420"></a>00420 <span class="preprocessor">#endif</span>
<a name="l00421"></a>00421 <span class="preprocessor"></span>
<a name="l00422"></a>00422   <span class="keywordflow">return</span> data_[n];
<a name="l00423"></a>00423 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="a2d1c8a2b32725ca72e0f3256f9cd8cb6"></a><!-- doxytag: member="stk::StkFrames::operator[]" ref="a2d1c8a2b32725ca72e0f3256f9cd8cb6" args="(size_t n) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StkFloat stk::StkFrames::operator[] </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>n</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Subscript operator that returns the value at element <code>n</code> of self. </p>
<p>The index <code>n</code> must be between 0 and size less one. No range checking is performed unless _STK_DEBUG_ is defined. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00426"></a>00426 {
<a name="l00427"></a>00427 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00428"></a>00428 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( n &gt;= size_ ) {
<a name="l00429"></a>00429     std::ostringstream error;
<a name="l00430"></a>00430     error &lt;&lt; <span class="stringliteral">&quot;StkFrames::operator[]: invalid index (&quot;</span> &lt;&lt; n &lt;&lt; <span class="stringliteral">&quot;) value!&quot;</span>;
<a name="l00431"></a>00431     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
<a name="l00432"></a>00432   }
<a name="l00433"></a>00433 <span class="preprocessor">#endif</span>
<a name="l00434"></a>00434 <span class="preprocessor"></span>
<a name="l00435"></a>00435   <span class="keywordflow">return</span> data_[n];
<a name="l00436"></a>00436 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="a0f6a81d36a8905d782b283b9a05893e6"></a><!-- doxytag: member="stk::StkFrames::operator+=" ref="a0f6a81d36a8905d782b283b9a05893e6" args="(StkFrames &amp;f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stk::StkFrames::operator+= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>f</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Assignment by sum operator into self. </p>
<p>The dimensions of the argument are expected to be the same as self. No range checking is performed unless _STK_DEBUG_ is defined. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00465"></a>00465 {
<a name="l00466"></a>00466 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00467"></a>00467 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( f.frames() != nFrames_ || f.channels() != nChannels_ ) {
<a name="l00468"></a>00468     std::ostringstream error;
<a name="l00469"></a>00469     error &lt;&lt; <span class="stringliteral">&quot;StkFrames::operator+=: frames argument must be of equal dimensions!&quot;</span>;
<a name="l00470"></a>00470     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
<a name="l00471"></a>00471   }
<a name="l00472"></a>00472 <span class="preprocessor">#endif</span>
<a name="l00473"></a>00473 <span class="preprocessor"></span>
<a name="l00474"></a>00474   StkFloat *fptr = &amp;f[0];
<a name="l00475"></a>00475   StkFloat *dptr = data_;
<a name="l00476"></a>00476   <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;size_; i++ )
<a name="l00477"></a>00477     *dptr++ += *fptr++;
<a name="l00478"></a>00478 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="a049cbfd10908f754a7c48c1dd0da21e0"></a><!-- doxytag: member="stk::StkFrames::operator*=" ref="a049cbfd10908f754a7c48c1dd0da21e0" args="(StkFrames &amp;f)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stk::StkFrames::operator*= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>f</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Assignment by product operator into self. </p>
<p>The dimensions of the argument are expected to be the same as self. No range checking is performed unless _STK_DEBUG_ is defined. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00481"></a>00481 {
<a name="l00482"></a>00482 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00483"></a>00483 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( f.frames() != nFrames_ || f.channels() != nChannels_ ) {
<a name="l00484"></a>00484     std::ostringstream error;
<a name="l00485"></a>00485     error &lt;&lt; <span class="stringliteral">&quot;StkFrames::operator*=: frames argument must be of equal dimensions!&quot;</span>;
<a name="l00486"></a>00486     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
<a name="l00487"></a>00487   }
<a name="l00488"></a>00488 <span class="preprocessor">#endif</span>
<a name="l00489"></a>00489 <span class="preprocessor"></span>
<a name="l00490"></a>00490   StkFloat *fptr = &amp;f[0];
<a name="l00491"></a>00491   StkFloat *dptr = data_;
<a name="l00492"></a>00492   <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;size_; i++ )
<a name="l00493"></a>00493     *dptr++ *= *fptr++;
<a name="l00494"></a>00494 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="a813632277bf0c432bcf81136ccdbbec1"></a><!-- doxytag: member="stk::StkFrames::operator()" ref="a813632277bf0c432bcf81136ccdbbec1" args="(size_t frame, unsigned int channel)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StkFloat &amp; stk::StkFrames::operator() </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>frame</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>channel</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Channel / frame subscript operator that returns a reference. </p>
<p>The result can be used as an lvalue. This reference is valid until the resize function is called or the array is destroyed. The <code>frame</code> index must be between 0 and <a class="el" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames()</a> - 1. The <code>channel</code> index must be between 0 and <a class="el" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels()</a> - 1. No range checking is performed unless _STK_DEBUG_ is defined. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00439"></a>00439 {
<a name="l00440"></a>00440 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00441"></a>00441 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( frame &gt;= nFrames_ || channel &gt;= nChannels_ ) {
<a name="l00442"></a>00442     std::ostringstream error;
<a name="l00443"></a>00443     error &lt;&lt; <span class="stringliteral">&quot;StkFrames::operator(): invalid frame (&quot;</span> &lt;&lt; frame &lt;&lt; <span class="stringliteral">&quot;) or channel (&quot;</span> &lt;&lt; channel &lt;&lt; <span class="stringliteral">&quot;) value!&quot;</span>;
<a name="l00444"></a>00444     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
<a name="l00445"></a>00445   }
<a name="l00446"></a>00446 <span class="preprocessor">#endif</span>
<a name="l00447"></a>00447 <span class="preprocessor"></span>
<a name="l00448"></a>00448   <span class="keywordflow">return</span> data_[ frame * nChannels_ + channel ];
<a name="l00449"></a>00449 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="a93e7e4c30affc29d0cdc98e7514188de"></a><!-- doxytag: member="stk::StkFrames::operator()" ref="a93e7e4c30affc29d0cdc98e7514188de" args="(size_t frame, unsigned int channel) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StkFloat stk::StkFrames::operator() </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>frame</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>channel</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Channel / frame subscript operator that returns a value. </p>
<p>The <code>frame</code> index must be between 0 and <a class="el" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames()</a> - 1. The <code>channel</code> index must be between 0 and <a class="el" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels()</a> - 1. No range checking is performed unless _STK_DEBUG_ is defined. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00452"></a>00452 {
<a name="l00453"></a>00453 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00454"></a>00454 <span class="preprocessor"></span>  <span class="keywordflow">if</span> ( frame &gt;= nFrames_ || channel &gt;= nChannels_ ) {
<a name="l00455"></a>00455     std::ostringstream error;
<a name="l00456"></a>00456     error &lt;&lt; <span class="stringliteral">&quot;StkFrames::operator(): invalid frame (&quot;</span> &lt;&lt; frame &lt;&lt; <span class="stringliteral">&quot;) or channel (&quot;</span> &lt;&lt; channel &lt;&lt; <span class="stringliteral">&quot;) value!&quot;</span>;
<a name="l00457"></a>00457     <a class="code" href="classstk_1_1Stk.html#a48ac73a0d8ca28445ba1a054e1f061ff" title="Static function for error reporting and handling using c-strings.">Stk::handleError</a>( error.str(), StkError::MEMORY_ACCESS );
<a name="l00458"></a>00458   }
<a name="l00459"></a>00459 <span class="preprocessor">#endif</span>
<a name="l00460"></a>00460 <span class="preprocessor"></span>
<a name="l00461"></a>00461   <span class="keywordflow">return</span> data_[ frame * nChannels_ + channel ];
<a name="l00462"></a>00462 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="a4f9402d9be28da418f630b4261b9b386"></a><!-- doxytag: member="stk::StkFrames::interpolate" ref="a4f9402d9be28da418f630b4261b9b386" args="(StkFloat frame, unsigned int channel=0) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">StkFloat stk::StkFrames::interpolate </td>
          <td>(</td>
          <td class="paramtype">StkFloat&nbsp;</td>
          <td class="paramname"> <em>frame</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> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return an interpolated value at the fractional frame index and channel. </p>
<p>This function performs linear interpolation. The <code>frame</code> index must be between 0.0 and <a class="el" href="classstk_1_1StkFrames.html#a05b1ab6fa750a8221a7d65c30e0cdab9" title="Return the number of sample frames represented by the data.">frames()</a> - 1. The <code>channel</code> index must be between 0 and <a class="el" href="classstk_1_1StkFrames.html#aec7ef9c46675a24111aa6e2fda3ba870" title="Return the number of channels represented by the data.">channels()</a> - 1. No range checking is performed unless _STK_DEBUG_ is defined. </p>

</div>
</div>
<a class="anchor" id="a386e1b86cf48f7a8117313f9e41fc0fe"></a><!-- doxytag: member="stk::StkFrames::resize" ref="a386e1b86cf48f7a8117313f9e41fc0fe" args="(size_t nFrames, unsigned int nChannels=1)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stk::StkFrames::resize </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>nFrames</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>nChannels</em> = <code>1</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Resize self to represent the specified number of channels and frames. </p>
<p>Changes the size of self based on the number of frames and channels. No element assignment is performed. No memory deallocation occurs if the new size is smaller than the previous size. Further, no new memory is allocated when the new size is smaller or equal to a previously allocated size. </p>

</div>
</div>
<a class="anchor" id="a57ecf6563fdd2d3732aa9de2692af32e"></a><!-- doxytag: member="stk::StkFrames::resize" ref="a57ecf6563fdd2d3732aa9de2692af32e" args="(size_t nFrames, unsigned int nChannels, StkFloat value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void stk::StkFrames::resize </td>
          <td>(</td>
          <td class="paramtype">size_t&nbsp;</td>
          <td class="paramname"> <em>nFrames</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>nChannels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">StkFloat&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Resize self to represent the specified number of channels and frames and perform element initialization. </p>
<p>Changes the size of self based on the number of frames and channels, and assigns <code>value</code> to every element. No memory deallocation occurs if the new size is smaller than the previous size. Further, no new memory is allocated when the new size is smaller or equal to a previously allocated size. </p>

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

<p>Set the sample rate associated with the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data. </p>
<p>By default, this value is set equal to the current STK sample rate at the time of instantiation. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00386"></a>00386 { dataRate_ = rate; };
</pre></div></p>

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

<p>Return the sample rate associated with the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> data. </p>
<p>By default, this value is set equal to the current STK sample rate at the time of instantiation. </p>

<p><div class="fragment"><pre class="fragment"><a name="l00393"></a>00393 { <span class="keywordflow">return</span> dataRate_; };
</pre></div></p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Stk_8h_source.html">Stk.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>