Files
stk/doc/html/Stk_8h-source.html
2013-09-29 23:33:56 +02:00

152 lines
10 KiB
HTML

<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"><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="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.2.8.1 -->
<h1>Stk.h</h1><div class="fragment"><pre>00001 <font class="comment">/***************************************************/</font>
00013 <font class="comment">/***************************************************/</font>
00014
00015 <font class="preprocessor">#if !defined(__STK_H)</font>
00016 <font class="preprocessor"></font><font class="preprocessor">#define __STK_H</font>
00017 <font class="preprocessor"></font>
00018 <font class="comment">// Most data in STK is passed and calculated with the following</font>
00019 <font class="comment">// user-definable floating-point type. You can change this to "float"</font>
00020 <font class="comment">// if you prefer or perhaps a "long double" in the future.</font>
00021 <font class="keyword">typedef</font> <font class="keywordtype">double</font> MY_FLOAT;
00022
00024
<a name="l00029"></a><a class="code" href="classStkError.html">00029</a> <font class="keyword">class </font><a class="code" href="classStkError.html">StkError</a>
00030 {
00031 <font class="keyword">public</font>:
00032 <font class="keyword">enum</font> TYPE {
00033 WARNING,
00034 DEBUG_WARNING,
00035 FUNCTION_ARGUMENT,
00036 FILE_NOT_FOUND,
00037 FILE_UNKNOWN_FORMAT,
00038 FILE_ERROR,
00039 PROCESS_THREAD,
00040 PROCESS_SOCKET,
00041 PROCESS_SOCKET_IPADDR,
00042 AUDIO_SYSTEM,
00043 MIDI_SYSTEM,
00044 UNSPECIFIED
00045 };
00046
00047 <font class="keyword">protected</font>:
00048 <font class="keywordtype">char</font> message[256];
00049 TYPE type;
00050
00051 <font class="keyword">public</font>:
00053 <a class="code" href="classStkError.html#a0">StkError</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *p, TYPE tipe = StkError::UNSPECIFIED);
00054
00056 <font class="keyword">virtual</font> <a class="code" href="classStkError.html#a1">~StkError</a>(<font class="keywordtype">void</font>);
00057
00059 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classStkError.html#a2">printMessage</a>(<font class="keywordtype">void</font>);
00060
<a name="l00062"></a><a class="code" href="classStkError.html#a3">00062</a> <font class="keyword">virtual</font> <font class="keyword">const</font> TYPE&amp; <a class="code" href="classStkError.html#a3">getType</a>(<font class="keywordtype">void</font>)<font class="keyword"> </font>{ <font class="keywordflow">return</font> type; }
00063
<a name="l00065"></a><a class="code" href="classStkError.html#a4">00065</a> <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *<a class="code" href="classStkError.html#a4">getMessage</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> message; }
00066 };
00067
00068
00069 <font class="keyword">class </font><a class="code" href="classStk.html">Stk</a>
00070 {
00071 <font class="keyword">public</font>:
00072
00073 <font class="keyword">typedef</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> STK_FORMAT;
<a name="l00074"></a><a class="code" href="classStk.html#p0">00074</a> <font class="keyword">static</font> <font class="keyword">const</font> STK_FORMAT STK_SINT8;
<a name="l00075"></a><a class="code" href="classStk.html#p1">00075</a> <font class="keyword">static</font> <font class="keyword">const</font> STK_FORMAT STK_SINT16;
<a name="l00076"></a><a class="code" href="classStk.html#p2">00076</a> <font class="keyword">static</font> <font class="keyword">const</font> STK_FORMAT STK_SINT32;
<a name="l00077"></a><a class="code" href="classStk.html#p3">00077</a> <font class="keyword">static</font> <font class="keyword">const</font> STK_FORMAT STK_FLOAT32;
<a name="l00078"></a><a class="code" href="classStk.html#p4">00078</a> <font class="keyword">static</font> <font class="keyword">const</font> STK_FORMAT STK_FLOAT64;
00079
00081 <font class="keyword">static</font> MY_FLOAT <a class="code" href="classStk.html#d0">sampleRate</a>(<font class="keywordtype">void</font>);
00082
00084
00092 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classStk.html#d1">setSampleRate</a>(MY_FLOAT newRate);
00093
00095 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classStk.html#d2">swap16</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *ptr);
00096
00098 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classStk.html#d3">swap32</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *ptr);
00099
00101 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classStk.html#d4">swap64</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> *ptr);
00102
00104 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classStk.html#d5">sleep</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> milliseconds);
00105
00106 <font class="keyword">private</font>:
00107 <font class="keyword">static</font> MY_FLOAT srate;
00108
00109 <font class="keyword">protected</font>:
00110
00112 <a class="code" href="classStk.html#b0">Stk</a>(<font class="keywordtype">void</font>);
00113
00115 <font class="keyword">virtual</font> <a class="code" href="classStk.html#b1">~Stk</a>(<font class="keywordtype">void</font>);
00116
00118 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classStk.html#e0">handleError</a>( <font class="keyword">const</font> <font class="keywordtype">char</font> *message, StkError::TYPE type );
00119
00120 };
00121
00122 <font class="comment">// Here are a few other useful typedefs.</font>
00123 <font class="keyword">typedef</font> <font class="keywordtype">signed</font> <font class="keywordtype">short</font> SINT16;
00124 <font class="keyword">typedef</font> <font class="keywordtype">signed</font> <font class="keywordtype">int</font> SINT32;
00125 <font class="keyword">typedef</font> <font class="keywordtype">float</font> FLOAT32;
00126 <font class="keyword">typedef</font> <font class="keywordtype">double</font> FLOAT64;
00127
00128 <font class="comment">// Boolean values</font>
00129 <font class="preprocessor">#define FALSE 0</font>
00130 <font class="preprocessor"></font><font class="preprocessor">#define TRUE 1</font>
00131 <font class="preprocessor"></font>
00132 <font class="comment">// The default sampling rate.</font>
00133 <font class="preprocessor">#define SRATE (MY_FLOAT) 22050.0</font>
00134 <font class="preprocessor"></font>
00135 <font class="comment">// Real-time audio input and output buffer size. If clicks are</font>
00136 <font class="comment">// occuring in the input and/or output sound stream, a larger buffer</font>
00137 <font class="comment">// size may help. Larger buffer sizes, however, produce more latency.</font>
00138
00139 <font class="preprocessor">#define RT_BUFFER_SIZE 512</font>
00140 <font class="preprocessor"></font>
00141 <font class="comment">// The RAWWAVE_PATH definition is concatenated to the beginning of all</font>
00142 <font class="comment">// references to rawwave files in the various STK core classes</font>
00143 <font class="comment">// (ex. Clarinet.cpp). If you wish to move the rawwaves directory to</font>
00144 <font class="comment">// a different location in your file system, you will need to set this</font>
00145 <font class="comment">// path definition appropriately. The current definition is a</font>
00146 <font class="comment">// relative reference that will work "out of the box" for the STK</font>
00147 <font class="comment">// distribution.</font>
00148 <font class="preprocessor">#define RAWWAVE_PATH "../../"</font>
00149 <font class="preprocessor"></font>
00150 <font class="preprocessor">#define PI (MY_FLOAT) 3.14159265359</font>
00151 <font class="preprocessor"></font><font class="preprocessor">#define TWO_PI (MY_FLOAT) (MY_FLOAT) (2 * PI)</font>
00152 <font class="preprocessor"></font>
00153 <font class="preprocessor">#define ONE_OVER_128 (MY_FLOAT) 0.0078125</font>
00154 <font class="preprocessor"></font>
00155 <font class="preprocessor">#if defined(__WINDOWS_DS__)</font>
00156 <font class="preprocessor"></font><font class="preprocessor"> #define __OS_WINDOWS__</font>
00157 <font class="preprocessor"></font><font class="preprocessor"> #define __STK_REALTIME__</font>
00158 <font class="preprocessor"></font><font class="preprocessor">#elif defined(__LINUX_OSS__) || defined(__LINUX_ALSA__)</font>
00159 <font class="preprocessor"></font><font class="preprocessor"> #define __OS_LINUX__</font>
00160 <font class="preprocessor"></font><font class="preprocessor"> #define __STK_REALTIME__</font>
00161 <font class="preprocessor"></font><font class="preprocessor">#elif defined(__IRIX_AL__)</font>
00162 <font class="preprocessor"></font><font class="preprocessor"> #define __OS_IRIX__</font>
00163 <font class="preprocessor"></font><font class="preprocessor"> #define __STK_REALTIME__</font>
00164 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00165 <font class="preprocessor"></font>
00166 <font class="comment">//#define _STK_DEBUG_</font>
00167
00168 <font class="preprocessor">#endif</font>
</font></pre></div><HR>
<table>
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>&copy;1995-2002 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>