mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
100 lines
9.9 KiB
HTML
100 lines
9.9 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"> <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="dir_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>FM.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FM_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FM_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "Instrmnt.h"</span>
|
|
<a name="l00005"></a>00005 <span class="preprocessor">#include "ADSR.h"</span>
|
|
<a name="l00006"></a>00006 <span class="preprocessor">#include "FileLoop.h"</span>
|
|
<a name="l00007"></a>00007 <span class="preprocessor">#include "SineWave.h"</span>
|
|
<a name="l00008"></a>00008 <span class="preprocessor">#include "TwoZero.h"</span>
|
|
<a name="l00009"></a>00009
|
|
<a name="l00010"></a>00010 <span class="keyword">namespace </span>stk {
|
|
<a name="l00011"></a>00011
|
|
<a name="l00012"></a>00012 <span class="comment">/***************************************************/</span>
|
|
<a name="l00035"></a>00035 <span class="comment">/***************************************************/</span>
|
|
<a name="l00036"></a>00036
|
|
<a name="l00037"></a><a class="code" href="classstk_1_1FM.html">00037</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FM.html" title="STK abstract FM synthesis base class.">FM</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Instrmnt.html" title="STK instrument abstract base class.">Instrmnt</a>
|
|
<a name="l00038"></a>00038 {
|
|
<a name="l00039"></a>00039 <span class="keyword">public</span>:
|
|
<a name="l00041"></a>00041
|
|
<a name="l00044"></a>00044 <a class="code" href="classstk_1_1FM.html#af4732c22ce00743e1f751880fa07aa15" title="Class constructor, taking the number of wave/envelope operators to control.">FM</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> operators = 4 );
|
|
<a name="l00045"></a>00045
|
|
<a name="l00047"></a>00047 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FM.html#aaba7e8bff02d105e146f8b62b20a27b9" title="Class destructor.">~FM</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00048"></a>00048
|
|
<a name="l00050"></a>00050 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ac5697f9929afd43379e8720f2f271b2d" title="Reset and clear all wave and envelope states.">clear</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00051"></a>00051
|
|
<a name="l00053"></a>00053 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a0a32c8327e842bb71ce945024d583941" title="Load the rawwave filenames in waves.">loadWaves</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> **filenames );
|
|
<a name="l00054"></a>00054
|
|
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a8182c605d51ec623f90f4e07c2b90891" title="Set instrument parameters for a particular frequency.">setFrequency</a>( StkFloat frequency );
|
|
<a name="l00057"></a>00057
|
|
<a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a58f0898b677750a259036f628ec1a91b" title="Set the frequency ratio for the specified wave.">setRatio</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat ratio );
|
|
<a name="l00060"></a>00060
|
|
<a name="l00062"></a>00062 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a65a8c54556f0c288871876ffad4d9eef" title="Set the gain for the specified wave.">setGain</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waveIndex, StkFloat gain );
|
|
<a name="l00063"></a>00063
|
|
<a name="l00065"></a><a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6">00065</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a33e5d60131014a12a435c0ef20d104b6" title="Set the modulation speed in Hz.">setModulationSpeed</a>( StkFloat mSpeed ) { vibrato_.<a class="code" href="classstk_1_1SineWave.html#a1047a43714bc2e40c7e31e8f7e34adbc" title="Set the data interpolation rate based on a looping frequency.">setFrequency</a>( mSpeed ); };
|
|
<a name="l00066"></a>00066
|
|
<a name="l00068"></a><a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a">00068</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a11584256f23153551bc13b59518b415a" title="Set the modulation depth.">setModulationDepth</a>( StkFloat mDepth ) { modDepth_ = mDepth; };
|
|
<a name="l00069"></a>00069
|
|
<a name="l00071"></a><a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a">00071</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a0425269a8fc0cc6bb7471d65b54b8a1a" title="Set the value of control1.">setControl1</a>( StkFloat cVal ) { control1_ = cVal * 2.0; };
|
|
<a name="l00072"></a>00072
|
|
<a name="l00074"></a><a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca">00074</a> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#ad7e7d7067c8893040ef3bdf8a1fbe9ca" title="Set the value of control1.">setControl2</a>( StkFloat cVal ) { control2_ = cVal * 2.0; };
|
|
<a name="l00075"></a>00075
|
|
<a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#afc46280177d770404919f20ccf88e4ff" title="Start envelopes toward &quot;on&quot; targets.">keyOn</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00078"></a>00078
|
|
<a name="l00080"></a>00080 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a7235e94a153df135330a591511269f7c" title="Start envelopes toward &quot;off&quot; targets.">keyOff</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00081"></a>00081
|
|
<a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a56cc61b1923dba2ff80859df4904d4f9" title="Stop a note with the given amplitude (speed of decay).">noteOff</a>( StkFloat amplitude );
|
|
<a name="l00084"></a>00084
|
|
<a name="l00086"></a>00086 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FM.html#a1db9d177363fb7d8dedb20fa0c9104f1" title="Perform the control change specified by number and value (0.0 - 128.0).">controlChange</a>( <span class="keywordtype">int</span> number, StkFloat value );
|
|
<a name="l00087"></a>00087
|
|
<a name="l00089"></a>00089 <span class="keyword">virtual</span> StkFloat <a class="code" href="classstk_1_1FM.html#a81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) = 0;
|
|
<a name="l00090"></a>00090
|
|
<a name="l00092"></a>00092
|
|
<a name="l00099"></a>00099 <span class="keyword">virtual</span> <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& <a class="code" href="classstk_1_1FM.html#a81f351fd8732fd6e686735b7b45a4241" title="Compute and return one output sample.">tick</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& frames, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channel = 0 ) = 0;
|
|
<a name="l00100"></a>00100
|
|
<a name="l00101"></a>00101 <span class="keyword">protected</span>:
|
|
<a name="l00102"></a>00102
|
|
<a name="l00103"></a>00103 std::vector<ADSR *> adsr_;
|
|
<a name="l00104"></a>00104 std::vector<FileLoop *> waves_;
|
|
<a name="l00105"></a>00105 <a class="code" href="classstk_1_1SineWave.html" title="STK sinusoid oscillator class.">SineWave</a> vibrato_;
|
|
<a name="l00106"></a>00106 <a class="code" href="classstk_1_1TwoZero.html" title="STK two-zero filter class.">TwoZero</a> twozero_;
|
|
<a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nOperators_;
|
|
<a name="l00108"></a>00108 StkFloat baseFrequency_;
|
|
<a name="l00109"></a>00109 std::vector<StkFloat> ratios_;
|
|
<a name="l00110"></a>00110 std::vector<StkFloat> gains_;
|
|
<a name="l00111"></a>00111 StkFloat modDepth_;
|
|
<a name="l00112"></a>00112 StkFloat control1_;
|
|
<a name="l00113"></a>00113 StkFloat control2_;
|
|
<a name="l00114"></a>00114 StkFloat fmGains_[100];
|
|
<a name="l00115"></a>00115 StkFloat fmSusLevels_[16];
|
|
<a name="l00116"></a>00116 StkFloat fmAttTimes_[32];
|
|
<a name="l00117"></a>00117
|
|
<a name="l00118"></a>00118 };
|
|
<a name="l00119"></a>00119
|
|
<a name="l00120"></a>00120 } <span class="comment">// stk namespace</span>
|
|
<a name="l00121"></a>00121
|
|
<a name="l00122"></a>00122 <span class="preprocessor">#endif</span>
|
|
</pre></div></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|