mirror of
https://github.com/thestk/stk
synced 2026-04-20 06:26:55 +00:00
Release 4.4.2 tarball
This commit is contained in:
committed by
Stephen Sinclair
parent
c37de52787
commit
7fcf920d3e
@@ -8,13 +8,17 @@
|
||||
<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.5.8 -->
|
||||
<!-- Generated by Doxygen 1.6.2 -->
|
||||
<div class="contents">
|
||||
<h1><a class="anchor" name="realtime">Realtime Audio (blocking) </a></h1>In this section, we modify the <code>sineosc.cpp</code> program in order to send the output to the default audio playback device on your computer system. We also make use of the <a class="el" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">stk::SineWave</a> class as a sine-wave oscillator. <a class="el" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">stk::SineWave</a> computes an internal, static sine-wave table when its first instance is created. Subsequent instances make use of the same table. The default table length, specified in <a class="el" href="SineWave_8h-source.html">SineWave.h</a>, is 2048 samples.<p>
|
||||
|
||||
|
||||
<h1><a class="anchor" id="realtime">Realtime Audio (blocking) </a></h1><p>In this section, we modify the <code>sineosc.cpp</code> program in order to send the output to the default audio playback device on your computer system. We also make use of the <a class="el" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">stk::SineWave</a> class as a sine-wave oscillator. <a class="el" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">stk::SineWave</a> computes an internal, static sine-wave table when its first instance is created. Subsequent instances make use of the same table. The default table length, specified in <a class="el" href="SineWave_8h_source.html">SineWave.h</a>, is 2048 samples.</p>
|
||||
<div class="fragment"><pre class="fragment"><span class="comment">// rtsine.cpp STK tutorial program</span>
|
||||
|
||||
<span class="preprocessor">#include "SineWave.h"</span>
|
||||
<span class="preprocessor">#include "RtWvOut.h"</span>
|
||||
<span class="preprocessor">#include "SineWave.h"</span>
|
||||
<span class="preprocessor">#include "RtWvOut.h"</span>
|
||||
<span class="preprocessor">#include <cstdlib></span>
|
||||
|
||||
<span class="keyword">using namespace </span>stk;
|
||||
|
||||
<span class="keywordtype">int</span> main()
|
||||
@@ -63,24 +67,22 @@
|
||||
|
||||
<span class="keywordflow">return</span> 0;
|
||||
}
|
||||
</pre></div><p>
|
||||
The class <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> is a protected subclass of <a class="el" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">stk::WvOut</a>. A number of optional constructor arguments can be used to fine tune its performance for a given system. <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> provides a "single-sample", blocking interface to the <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> class. Note that <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> (as well as the <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a> class described below) makes use of RtAudio's callback input/output functionality by creating a large ring-buffer into which data is written. These classes should not be used when low-latency and robust performance is necessary<p>
|
||||
Though not used here, an <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a> class exists as well that can be used to read realtime audio data from an input device. See the <code>record.cpp</code> example program in the <code>examples</code> project for more information.<p>
|
||||
It may be possible to use an instance of <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> and an instance of <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a> to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> to achieve this behavior, as described in the next section. See the <code>effects</code> project or the <code>duplex.cpp</code> example program in the <code>examples</code> project for more information.<p>
|
||||
When using any realtime STK class (<a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>, <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a>, <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a>, <a class="el" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>, <a class="el" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">stk::InetWvIn</a>, <a class="el" href="classstk_1_1InetWvOut.html" title="STK internet streaming output class.">stk::InetWvOut</a>, <a class="el" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">stk::Socket</a>, <a class="el" href="classstk_1_1UdpSocket.html" title="STK UDP socket server/client class.">stk::UdpSocket</a>, <a class="el" href="classstk_1_1TcpServer.html" title="STK TCP socket server class.">stk::TcpServer</a>, <a class="el" href="classstk_1_1TcpClient.html" title="STK TCP socket client class.">stk::TcpClient</a>, and <a class="el" href="classstk_1_1Thread.html" title="STK thread class.">stk::Thread</a>), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio API as follows (assuming all necessary files exist in the project directory):<p>
|
||||
</pre></div><p>The class <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> is a protected subclass of <a class="el" href="classstk_1_1WvOut.html" title="STK audio output abstract base class.">stk::WvOut</a>. A number of optional constructor arguments can be used to fine tune its performance for a given system. <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> provides a "single-sample", blocking interface to the <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> class. Note that <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> (as well as the <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a> class described below) makes use of RtAudio's callback input/output functionality by creating a large ring-buffer into which data is written. These classes should not be used when low-latency and robust performance is necessary</p>
|
||||
<p>Though not used here, an <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a> class exists as well that can be used to read realtime audio data from an input device. See the <code>record.cpp</code> example program in the <code>examples</code> project for more information.</p>
|
||||
<p>It may be possible to use an instance of <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a> and an instance of <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a> to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> to achieve this behavior, as described in the next section. See the <code>effects</code> project or the <code>duplex.cpp</code> example program in the <code>examples</code> project for more information.</p>
|
||||
<p>When using any realtime STK class (<a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>, <a class="el" href="classstk_1_1RtWvOut.html" title="STK realtime audio (blocking) output class.">stk::RtWvOut</a>, <a class="el" href="classstk_1_1RtWvIn.html" title="STK realtime audio (blocking) input class.">stk::RtWvIn</a>, <a class="el" href="classRtMidi.html" title="An abstract base class for realtime MIDI input/output.">RtMidi</a>, <a class="el" href="classstk_1_1InetWvIn.html" title="STK internet streaming input class.">stk::InetWvIn</a>, <a class="el" href="classstk_1_1InetWvOut.html" title="STK internet streaming output class.">stk::InetWvOut</a>, <a class="el" href="classstk_1_1Socket.html" title="STK internet socket abstract base class.">stk::Socket</a>, <a class="el" href="classstk_1_1UdpSocket.html" title="STK UDP socket server/client class.">stk::UdpSocket</a>, <a class="el" href="classstk_1_1TcpServer.html" title="STK TCP socket server class.">stk::TcpServer</a>, <a class="el" href="classstk_1_1TcpClient.html" title="STK TCP socket client class.">stk::TcpClient</a>, and <a class="el" href="classstk_1_1Thread.html" title="STK thread class.">stk::Thread</a>), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio API as follows (assuming all necessary files exist in the project directory):</p>
|
||||
<div class="fragment"><pre class="fragment">g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine Stk.cpp Generator.cpp SineWave.cpp WvOut.cpp \
|
||||
RtWvOut.cpp <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>.cpp rtsine.cpp -lpthread -lasound
|
||||
</pre></div><p>
|
||||
On a Macintosh OS X system, the syntax would be:<p>
|
||||
</pre></div><p>On a Macintosh OS X system, the syntax would be:</p>
|
||||
<div class="fragment"><pre class="fragment">g++ -Wall -D__MACOSX_CORE__ -o rtsine Stk.cpp Generator.cpp SineWave.cpp WvOut.cpp RtWvOut.cpp <a class="code" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a>.cpp \
|
||||
rtsine.cpp -lpthread -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
|
||||
</pre></div><p>
|
||||
[<a href="tutorial.html">Main tutorial page</a>] [<a href="crealtime.html">Next tutorial</a>] </div>
|
||||
</pre></div><p>[<a href="tutorial.html">Main tutorial page</a>] [<a href="crealtime.html">Next tutorial</a>] </p>
|
||||
</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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
<tr><td>©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||
</table>
|
||||
|
||||
</BODY>
|
||||
|
||||
Reference in New Issue
Block a user