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
|
<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="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1Voicer.html">Voicer</a>
</div>
<div class="contents">
<h1>stk::Voicer Class Reference</h1><!-- doxytag: class="stk::Voicer" --><!-- doxytag: inherits="stk::Stk" -->
<p>STK voice manager class.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="Voicer_8h_source.html">Voicer.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for stk::Voicer:</div>
<div class="dynsection">
<div class="center">
<img src="classstk_1_1Voicer.png" usemap="#stk::Voicer_map" alt=""/>
<map id="stk::Voicer_map" name="stk::Voicer_map">
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,71,24"/>
</map>
</div>
</div>
<p><a href="classstk_1_1Voicer-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="a4b2eb777e91f0dd33403ec23c68bb43f"></a><!-- doxytag: member="stk::Voicer::Voicer" ref="a4b2eb777e91f0dd33403ec23c68bb43f" args="(StkFloat decayTime=0.2)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a4b2eb777e91f0dd33403ec23c68bb43f">Voicer</a> (StkFloat decayTime=0.2)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class constructor taking an optional note decay time (in seconds). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#aff9fc9304ef6ae9f7aa1e15611728b8c">addInstrument</a> (<a class="el" href="classstk_1_1Instrmnt.html">Instrmnt</a> *instrument, int group=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Add an instrument with an optional group number to the voice manager. <a href="#aff9fc9304ef6ae9f7aa1e15611728b8c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#ac5190f84fb8507cac2a18dece242d4d8">removeInstrument</a> (<a class="el" href="classstk_1_1Instrmnt.html">Instrmnt</a> *instrument)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Remove the given instrument pointer from the voice manager's control. <a href="#ac5190f84fb8507cac2a18dece242d4d8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#abd09d3a8e935fe36776f165038e33176">noteOn</a> (StkFloat noteNumber, StkFloat amplitude, int group=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initiate a noteOn event with the given note number and amplitude and return a unique note tag. <a href="#abd09d3a8e935fe36776f165038e33176"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a4843895d8e4c0fffdd165aa480e2dcde">noteOff</a> (StkFloat noteNumber, StkFloat amplitude, int group=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a noteOff to all voices having the given noteNumber and optional group (default group = 0). <a href="#a4843895d8e4c0fffdd165aa480e2dcde"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a5947c228168734fdc6d3527491ae40ad">noteOff</a> (long tag, StkFloat amplitude)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a noteOff to the voice with the given note tag. <a href="#a5947c228168734fdc6d3527491ae40ad"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a5ee3f8a17e031430486e030520709acf">setFrequency</a> (StkFloat noteNumber, int group=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a frequency update message to all voices assigned to the optional group argument (default group = 0). <a href="#a5ee3f8a17e031430486e030520709acf"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a4ffc98ccb636edd1cd6bb7d85391c556">setFrequency</a> (long tag, StkFloat noteNumber)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a frequency update message to the voice with the given note tag. <a href="#a4ffc98ccb636edd1cd6bb7d85391c556"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae2ab6a6804960c686509d7f919829ad4"></a><!-- doxytag: member="stk::Voicer::pitchBend" ref="ae2ab6a6804960c686509d7f919829ad4" args="(StkFloat value, int group=0)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#ae2ab6a6804960c686509d7f919829ad4">pitchBend</a> (StkFloat value, int group=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a pitchBend message to all voices assigned to the optional group argument (default group = 0). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab093e46365c99be9d77a9e38fcc780b4"></a><!-- doxytag: member="stk::Voicer::pitchBend" ref="ab093e46365c99be9d77a9e38fcc780b4" args="(long tag, StkFloat value)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#ab093e46365c99be9d77a9e38fcc780b4">pitchBend</a> (long tag, StkFloat value)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a pitchBend message to the voice with the given note tag. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab5fe99a639a872c90aed2541417cc896"></a><!-- doxytag: member="stk::Voicer::controlChange" ref="ab5fe99a639a872c90aed2541417cc896" args="(int number, StkFloat value, int group=0)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#ab5fe99a639a872c90aed2541417cc896">controlChange</a> (int number, StkFloat value, int group=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a controlChange to all instruments assigned to the optional group argument (default group = 0). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac3abcb8b3d402719426a13ffdb633522"></a><!-- doxytag: member="stk::Voicer::controlChange" ref="ac3abcb8b3d402719426a13ffdb633522" args="(long tag, int number, StkFloat value)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#ac3abcb8b3d402719426a13ffdb633522">controlChange</a> (long tag, int number, StkFloat value)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a controlChange to the voice with the given note tag. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a238f0936f6c0b54c7eb756ad3ac1f019"></a><!-- doxytag: member="stk::Voicer::silence" ref="a238f0936f6c0b54c7eb756ad3ac1f019" args="(void)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a238f0936f6c0b54c7eb756ad3ac1f019">silence</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Send a noteOff message to all existing voices. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a35230ae97772ae581fb9658a5f4d57b6"></a><!-- doxytag: member="stk::Voicer::channelsOut" ref="a35230ae97772ae581fb9658a5f4d57b6" args="(void) const " -->
unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a35230ae97772ae581fb9658a5f4d57b6">channelsOut</a> (void) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the current number of output channels. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a50caec57c6a566e4836181774adf5e7b"></a><!-- doxytag: member="stk::Voicer::lastFrame" ref="a50caec57c6a566e4836181774adf5e7b" args="(void) const " -->
const <a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a50caec57c6a566e4836181774adf5e7b">lastFrame</a> (void) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return an <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> reference to the last output sample frame. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a98d843fa1f9fd2ad9a9fb03538dba03a">lastOut</a> (unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the specified channel value of the last computed frame. <a href="#a98d843fa1f9fd2ad9a9fb03538dba03a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70">tick</a> (unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Mix one sample frame of all sounding voices and return the specified <code>channel</code> value. <a href="#a3e504b3a6b896772b0f94a12faf0ee70"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1Voicer.html#a3fd795b0fce684c470484936ef39aa16">tick</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &frames, unsigned int channel=0)</td></tr>
<tr><td class="mdescLeft"> </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="#a3fd795b0fce684c470484936ef39aa16"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>STK voice manager class. </p>
<p>This class can be used to manage a group of STK instrument classes. Individual voices can be controlled via unique note tags. Instrument groups can be controlled by group number.</p>
<p>A previously constructed STK instrument class is linked with a voice manager using the <a class="el" href="classstk_1_1Voicer.html#aff9fc9304ef6ae9f7aa1e15611728b8c" title="Add an instrument with an optional group number to the voice manager.">addInstrument()</a> function. An optional group number argument can be specified to the <a class="el" href="classstk_1_1Voicer.html#aff9fc9304ef6ae9f7aa1e15611728b8c" title="Add an instrument with an optional group number to the voice manager.">addInstrument()</a> function as well (default group = 0). The voice manager does not delete any instrument instances ... it is the responsibility of the user to allocate and deallocate all instruments.</p>
<p>The <a class="el" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">tick()</a> function returns the mix of all sounding voices. Each noteOn returns a unique tag (credits to the NeXT MusicKit), so you can send control changes to specific voices within an ensemble. Alternately, control changes can be sent to all voices in a given group.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995-2012. </p>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aff9fc9304ef6ae9f7aa1e15611728b8c"></a><!-- doxytag: member="stk::Voicer::addInstrument" ref="aff9fc9304ef6ae9f7aa1e15611728b8c" args="(Instrmnt *instrument, int group=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Voicer::addInstrument </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1Instrmnt.html">Instrmnt</a> * </td>
<td class="paramname"> <em>instrument</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>group</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Add an instrument with an optional group number to the voice manager. </p>
<p>A set of instruments can be grouped by group number and controlled via the functions that take a group number argument. </p>
</div>
</div>
<a class="anchor" id="ac5190f84fb8507cac2a18dece242d4d8"></a><!-- doxytag: member="stk::Voicer::removeInstrument" ref="ac5190f84fb8507cac2a18dece242d4d8" args="(Instrmnt *instrument)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Voicer::removeInstrument </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1Instrmnt.html">Instrmnt</a> * </td>
<td class="paramname"> <em>instrument</em></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Remove the given instrument pointer from the voice manager's control. </p>
<p>It is important that any instruments which are to be deleted by the user while the voice manager is running be first removed from the manager's control via this function!! </p>
</div>
</div>
<a class="anchor" id="abd09d3a8e935fe36776f165038e33176"></a><!-- doxytag: member="stk::Voicer::noteOn" ref="abd09d3a8e935fe36776f165038e33176" args="(StkFloat noteNumber, StkFloat amplitude, int group=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">long stk::Voicer::noteOn </td>
<td>(</td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>noteNumber</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>amplitude</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>group</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initiate a noteOn event with the given note number and amplitude and return a unique note tag. </p>
<p>Send the noteOn message to the first available unused voice. If all voices are sounding, the oldest voice is interrupted and sent the noteOn message. If the optional group argument is non-zero, only voices in that group are used. If no voices are found for a specified non-zero group value, the function returns -1. The amplitude value should be in the range 0.0 - 128.0. </p>
</div>
</div>
<a class="anchor" id="a4843895d8e4c0fffdd165aa480e2dcde"></a><!-- doxytag: member="stk::Voicer::noteOff" ref="a4843895d8e4c0fffdd165aa480e2dcde" args="(StkFloat noteNumber, StkFloat amplitude, int group=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Voicer::noteOff </td>
<td>(</td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>noteNumber</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>amplitude</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>group</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Send a noteOff to all voices having the given noteNumber and optional group (default group = 0). </p>
<p>The amplitude value should be in the range 0.0 - 128.0. </p>
</div>
</div>
<a class="anchor" id="a5947c228168734fdc6d3527491ae40ad"></a><!-- doxytag: member="stk::Voicer::noteOff" ref="a5947c228168734fdc6d3527491ae40ad" args="(long tag, StkFloat amplitude)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Voicer::noteOff </td>
<td>(</td>
<td class="paramtype">long </td>
<td class="paramname"> <em>tag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>amplitude</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Send a noteOff to the voice with the given note tag. </p>
<p>The amplitude value should be in the range 0.0 - 128.0. </p>
</div>
</div>
<a class="anchor" id="a5ee3f8a17e031430486e030520709acf"></a><!-- doxytag: member="stk::Voicer::setFrequency" ref="a5ee3f8a17e031430486e030520709acf" args="(StkFloat noteNumber, int group=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Voicer::setFrequency </td>
<td>(</td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>noteNumber</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>group</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Send a frequency update message to all voices assigned to the optional group argument (default group = 0). </p>
<p>The <em>noteNumber</em> argument corresponds to a MIDI note number, though it is a floating-point value and can range beyond the normal 0-127 range. </p>
</div>
</div>
<a class="anchor" id="a4ffc98ccb636edd1cd6bb7d85391c556"></a><!-- doxytag: member="stk::Voicer::setFrequency" ref="a4ffc98ccb636edd1cd6bb7d85391c556" args="(long tag, StkFloat noteNumber)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::Voicer::setFrequency </td>
<td>(</td>
<td class="paramtype">long </td>
<td class="paramname"> <em>tag</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>noteNumber</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Send a frequency update message to the voice with the given note tag. </p>
<p>The <em>noteNumber</em> argument corresponds to a MIDI note number, though it is a floating-point value and can range beyond the normal 0-127 range. </p>
</div>
</div>
<a class="anchor" id="a98d843fa1f9fd2ad9a9fb03538dba03a"></a><!-- doxytag: member="stk::Voicer::lastOut" ref="a98d843fa1f9fd2ad9a9fb03538dba03a" args="(unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">StkFloat stk::Voicer::lastOut </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>channel</em> = <code>0</code></td>
<td> ) </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>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_1Voicer.html#a35230ae97772ae581fb9658a5f4d57b6" title="Return the current number of output channels.">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_1Voicer.html#a50caec57c6a566e4836181774adf5e7b" title="Return an StkFrames reference to the last output sample frame.">lastFrame()</a> </dd></dl>
<p><div class="fragment"><pre class="fragment"><a name="l00166"></a>00166 {
<a name="l00167"></a>00167 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00168"></a>00168 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel >= lastFrame_.channels() ) {
<a name="l00169"></a>00169 oStream_ << <span class="stringliteral">"Voicer::lastOut(): channel argument is invalid!"</span>;
<a name="l00170"></a>00170 <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="l00171"></a>00171 }
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
<a name="l00173"></a>00173 <span class="preprocessor"></span>
<a name="l00174"></a>00174 <span class="keywordflow">return</span> lastFrame_[channel];
<a name="l00175"></a>00175 }
</pre></div></p>
</div>
</div>
<a class="anchor" id="a3e504b3a6b896772b0f94a12faf0ee70"></a><!-- doxytag: member="stk::Voicer::tick" ref="a3e504b3a6b896772b0f94a12faf0ee70" args="(unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">StkFloat stk::Voicer::tick </td>
<td>(</td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>channel</em> = <code>0</code></td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Mix one sample frame of all sounding voices and return the specified <code>channel</code> value. </p>
<p>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_1Voicer.html#a35230ae97772ae581fb9658a5f4d57b6" title="Return the current number of output channels.">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>
<p><div class="fragment"><pre class="fragment"><a name="l00179"></a>00179 {
<a name="l00180"></a>00180 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j;
<a name="l00181"></a>00181 <span class="keywordflow">for</span> ( j=0; j<lastFrame_.channels(); j++ ) lastFrame_[j] = 0.0;
<a name="l00182"></a>00182 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<voices_.size(); i++ ) {
<a name="l00183"></a>00183 <span class="keywordflow">if</span> ( voices_[i].sounding != 0 ) {
<a name="l00184"></a>00184 voices_[i].instrument->tick();
<a name="l00185"></a>00185 <span class="keywordflow">for</span> ( j=0; j<voices_[i].instrument->channelsOut(); j++ ) lastFrame_[j] += voices_[i].instrument->lastOut( j );
<a name="l00186"></a>00186 }
<a name="l00187"></a>00187 <span class="keywordflow">if</span> ( voices_[i].sounding < 0 )
<a name="l00188"></a>00188 voices_[i].sounding++;
<a name="l00189"></a>00189 <span class="keywordflow">if</span> ( voices_[i].sounding == 0 )
<a name="l00190"></a>00190 voices_[i].noteNumber = -1;
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192
<a name="l00193"></a>00193 <span class="keywordflow">return</span> lastFrame_[channel];
<a name="l00194"></a>00194 }
</pre></div></p>
</div>
</div>
<a class="anchor" id="a3fd795b0fce684c470484936ef39aa16"></a><!-- doxytag: member="stk::Voicer::tick" ref="a3fd795b0fce684c470484936ef39aa16" args="(StkFrames &frames, unsigned int channel=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & stk::Voicer::tick </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
<td class="paramname"> <em>frames</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>channel</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</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><div class="fragment"><pre class="fragment"><a name="l00197"></a>00197 {
<a name="l00198"></a>00198 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = lastFrame_.channels();
<a name="l00199"></a>00199 <span class="preprocessor">#if defined(_STK_DEBUG_)</span>
<a name="l00200"></a>00200 <span class="preprocessor"></span> <span class="keywordflow">if</span> ( channel > frames.channels() - nChannels ) {
<a name="l00201"></a>00201 oStream_ << <span class="stringliteral">"Voicer::tick(): channel and StkFrames arguments are incompatible!"</span>;
<a name="l00202"></a>00202 <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="l00203"></a>00203 }
<a name="l00204"></a>00204 <span class="preprocessor">#endif</span>
<a name="l00205"></a>00205 <span class="preprocessor"></span>
<a name="l00206"></a>00206 StkFloat *samples = &frames[channel];
<a name="l00207"></a>00207 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, hop = frames.channels() - nChannels;
<a name="l00208"></a>00208 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<frames.frames(); i++, samples += hop ) {
<a name="l00209"></a>00209 <a class="code" href="classstk_1_1Voicer.html#a3e504b3a6b896772b0f94a12faf0ee70" title="Mix one sample frame of all sounding voices and return the specified channel value...">tick</a>();
<a name="l00210"></a>00210 <span class="keywordflow">for</span> ( j=0; j<nChannels; j++ )
<a name="l00211"></a>00211 *samples++ = lastFrame_[j];
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213
<a name="l00214"></a>00214 <span class="keywordflow">return</span> frames;
<a name="l00215"></a>00215 }
</pre></div></p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Voicer_8h_source.html">Voicer.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>©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>
|