mirror of
https://github.com/thestk/stk
synced 2026-04-19 22:16:54 +00:00
Release 4.2.1 tarball
This commit is contained in:
committed by
Stephen Sinclair
parent
11cf5faa0a
commit
21b93795e7
@@ -8,11 +8,11 @@
|
||||
<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="tutorial.html">Tutorial</a></CENTER>
|
||||
<HR>
|
||||
<!-- Generated by Doxygen 1.3.4 -->
|
||||
<!-- Generated by Doxygen 1.4.4 -->
|
||||
<h1><a class="anchor" name="polyvoices">Voice Management</a></h1>The previous tutorial chapters were concerned only with monophonic ToolKit instrument playback and control. At this point, it should be relatively clear that one can instantiate multiple instruments and perhaps sum together their outputs or even direct their outputs to separate channels. It is less clear how one might go about controlling a group of instruments. The <a class="el" href="classVoicer.html">Voicer</a> class is designed to serve just this purpose.<p>
|
||||
The STK <a class="el" href="classVoicer.html">Voicer</a> class is a relatively simple voice manager. The user can dynamically add and delete instruments to/from its "control", with the option of controlling specific instruments via unique note tags and/or grouping sets of instruments via a "channel" number. All sounding instrument outputs are summed and returned via the <code>tick()</code> function. The <a class="el" href="classVoicer.html">Voicer</a> class responds to noteOn, noteOff, setFrequency, pitchBend, and controlChange messages, automatically assigning incoming messages to the voices in its control. When all voices are sounding and a new noteOn is encountered, the <a class="el" href="classVoicer.html">Voicer</a> interrupts the oldest sounding voice. The user is responsible for creating and deleting all instrument instances.<p>
|
||||
In the following example, we modify the <code>controlbee.cpp</code> program to make use of three <a class="el" href="classBeeThree.html">BeeThree</a> instruments, all controlled using a <a class="el" href="classVoicer.html">Voicer</a>.<p>
|
||||
<div class="fragment"><pre><span class="comment">// threebees.cpp STK tutorial program</span>
|
||||
<div class="fragment"><pre class="fragment"><span class="comment">// threebees.cpp STK tutorial program</span>
|
||||
|
||||
<span class="preprocessor">#include "BeeThree.h"</span>
|
||||
<span class="preprocessor">#include "RtAudio.h"</span>
|
||||
@@ -102,7 +102,7 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
<span class="keywordflow">if</span> ( !data->haveMessage ) {
|
||||
data->messager.popMessage( data->message );
|
||||
<span class="keywordflow">if</span> ( data->message.type > 0 ) {
|
||||
data->counter = (<span class="keywordtype">long</span>) (data->message.time * <a class="code" href="classStk.html#e0">Stk::sampleRate</a>());
|
||||
data->counter = (long) (data->message.time * <a class="code" href="classStk.html#e0">Stk::sampleRate</a>());
|
||||
data->haveMessage = <span class="keyword">true</span>;
|
||||
}
|
||||
<span class="keywordflow">else</span>
|
||||
@@ -133,7 +133,7 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
|
||||
<span class="keywordtype">int</span> i;
|
||||
TickData data;
|
||||
RtAudio *dac = 0;
|
||||
<a class="code" href="classRtAudio.html">RtAudio</a> *dac = 0;
|
||||
<a class="code" href="classInstrmnt.html">Instrmnt</a> *instrument[3];
|
||||
<span class="keywordflow">for</span> ( i=0; i<3; i++ ) instrument[i] = 0;
|
||||
|
||||
@@ -141,10 +141,10 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
RtAudioFormat format = ( <span class="keyword">sizeof</span>(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32;
|
||||
<span class="keywordtype">int</span> bufferSize = RT_BUFFER_SIZE;
|
||||
<span class="keywordflow">try</span> {
|
||||
dac = <span class="keyword">new</span> RtAudio(0, 1, 0, 0, format, (<span class="keywordtype">int</span>)Stk::sampleRate(), &bufferSize, 4);
|
||||
dac = <span class="keyword">new</span> <a class="code" href="classRtAudio.html">RtAudio</a>(0, 1, 0, 0, format, (<span class="keywordtype">int</span>)<a class="code" href="classStk.html#e0">Stk::sampleRate</a>(), &bufferSize, 4);
|
||||
}
|
||||
<span class="keywordflow">catch</span> (<a class="code" href="classRtError.html">RtError</a>& error) {
|
||||
error.printMessage();
|
||||
error.<a class="code" href="classRtError.html#a2">printMessage</a>();
|
||||
<span class="keywordflow">goto</span> cleanup;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
<span class="keywordflow">for</span> ( i=0; i<3; i++ )
|
||||
data.voicer.addInstrument( instrument[i] );
|
||||
|
||||
<span class="keywordflow">if</span> ( data.messager.startStdInput() == <span class="keyword">false</span> )
|
||||
<span class="keywordflow">if</span> ( data.messager.startStdInput() == false )
|
||||
<span class="keywordflow">goto</span> cleanup;
|
||||
|
||||
<span class="keywordflow">try</span> {
|
||||
@@ -169,7 +169,7 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
dac-><a class="code" href="classRtAudio.html#a13">startStream</a>();
|
||||
}
|
||||
<span class="keywordflow">catch</span> (<a class="code" href="classRtError.html">RtError</a> &error) {
|
||||
error.printMessage();
|
||||
error.<a class="code" href="classRtError.html#a2">printMessage</a>();
|
||||
<span class="keywordflow">goto</span> cleanup;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
dac-><a class="code" href="classRtAudio.html#a12">closeStream</a>();
|
||||
}
|
||||
<span class="keywordflow">catch</span> (<a class="code" href="classRtError.html">RtError</a> &error) {
|
||||
error.printMessage();
|
||||
error.<a class="code" href="classRtError.html#a2">printMessage</a>();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
@@ -194,15 +194,15 @@ In the following example, we modify the <code>controlbee.cpp</code> program to m
|
||||
}
|
||||
</pre></div><p>
|
||||
We have written this program to accept control messages from <code>STDIN</code>. Assuming the program is compiled as <code>threebees</code>, the three-voice SKINI scorefile <a href="tutorial/bachfugue.ski"><code>bachfugue.ski</code></a> (located in the <code>scores</code> directory with the examples) can be redirected to the program as:<p>
|
||||
<div class="fragment"><pre>threebees < scores/bachfugue.ski
|
||||
<div class="fragment"><pre class="fragment">threebees < scores/bachfugue.ski
|
||||
</pre></div><p>
|
||||
For more fun, surf to <a href="http://kern.humdrum.net/">Kern Scores</a> for a huge assortment of other scorefiles which can be downloaded in the SKINI format.<p>
|
||||
Another easy extension would be to add the <code>Messager::startMidiInput()</code> function to the program and then play the instruments via a MIDI keyboard.<p>
|
||||
Another easy extension would be to add the <code><a class="el" href="classMessager.html#a7">Messager::startMidiInput()</a></code> function to the program and then play the instruments via a MIDI keyboard.<p>
|
||||
[<a href="tutorial.html">Main tutorial page</a>] <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-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td>©1995-2005 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
Reference in New Issue
Block a user