441 lines
41 KiB
HTML
Executable File
441 lines
41 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Snd"</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SndTaskEndCB</span><span class=cF0>()
|
|
<a name="l3"></a>{</span><span class=cF2>//Will turn-off snd when a task gets killed.</span><span class=cF0>
|
|
<a name="l4"></a> </span><span class=cF5>Snd</span><span class=cF0>;
|
|
<a name="l5"></a> </span><span class=cF5>Exit</span><span class=cF0>;
|
|
<a name="l6"></a>}
|
|
<a name="l7"></a>
|
|
<a name="l8"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Snd/Math;Math"</span><span class=cF0>
|
|
<a name="l9"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>Saw</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> period)
|
|
<a name="l10"></a>{</span><span class=cF2>//Sawtooth. 0.0 - 1.0 think "(Sin+1)/2"</span><span class=cF0>
|
|
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (period) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (t>=0.0)
|
|
<a name="l13"></a> </span><span class=cF1>return</span><span class=cF0> t%period/period;
|
|
<a name="l14"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l15"></a> </span><span class=cF1>return</span><span class=cF0> 1.0+t%period/period;
|
|
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF1>return</span><span class=cF0> 0.0;
|
|
<a name="l18"></a>}
|
|
<a name="l19"></a>
|
|
<a name="l20"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>FullSaw</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> period)
|
|
<a name="l21"></a>{</span><span class=cF2>//Plus&Minus Sawtooth. 1.0 - -1.0 think "Sin"</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (period) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (t>=0.0)
|
|
<a name="l24"></a> </span><span class=cF1>return</span><span class=cF0> 2.0*(t%period/period)-1.0;
|
|
<a name="l25"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l26"></a> </span><span class=cF1>return</span><span class=cF0> 2.0*(t%period/period)+1.0;
|
|
<a name="l27"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> 0.0;
|
|
<a name="l29"></a>}
|
|
<a name="l30"></a>
|
|
<a name="l31"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>Caw</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> period)
|
|
<a name="l32"></a>{</span><span class=cF2>//Cawtooth. 1.0 - 0.0 think "(Cos+1)/2"</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (period) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l34"></a> </span><span class=cF1>if</span><span class=cF0> (t>=0.0)
|
|
<a name="l35"></a> </span><span class=cF1>return</span><span class=cF0> 1.0-t%period/period;
|
|
<a name="l36"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l37"></a> </span><span class=cF1>return</span><span class=cF0> -(t%period)/period;
|
|
<a name="l38"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l39"></a> </span><span class=cF1>return</span><span class=cF0> 1.0;
|
|
<a name="l40"></a>}
|
|
<a name="l41"></a>
|
|
<a name="l42"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>FullCaw</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> period)
|
|
<a name="l43"></a>{</span><span class=cF2>//Plus&Minus Cawtooth. 1.0 - -1.0 think "Cos"</span><span class=cF0>
|
|
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (period) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (t>=0.0)
|
|
<a name="l46"></a> </span><span class=cF1>return</span><span class=cF0> -2.0*(t%period/period)+1.0;
|
|
<a name="l47"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l48"></a> </span><span class=cF1>return</span><span class=cF0> -2.0*(t%period/period)-1.0;
|
|
<a name="l49"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF1>return</span><span class=cF0> 1.0;
|
|
<a name="l51"></a>}
|
|
<a name="l52"></a>
|
|
<a name="l53"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>Tri</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> period)
|
|
<a name="l54"></a>{</span><span class=cF2>//Triangle waveform. 0.0 - 1.0 - 0.0</span><span class=cF0>
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (period) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l56"></a> t=2.0*(</span><span class=cF5>Abs</span><span class=cF7>(</span><span class=cF0>t</span><span class=cF7>)</span><span class=cF0>%period)/period;
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (t<=1.0)
|
|
<a name="l58"></a> </span><span class=cF1>return</span><span class=cF0> t;
|
|
<a name="l59"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l60"></a> </span><span class=cF1>return</span><span class=cF0> 2.0-t;
|
|
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l62"></a> </span><span class=cF1>return</span><span class=cF0> 0.0;
|
|
<a name="l63"></a>}
|
|
<a name="l64"></a>
|
|
<a name="l65"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>FullTri</span><span class=cF0>(</span><span class=cF1>F64</span><span class=cF0> t,</span><span class=cF1>F64</span><span class=cF0> period)
|
|
<a name="l66"></a>{</span><span class=cF2>//Plus&Minus Triangle waveform. 0.0 - 1.0 - 0.0 - -1.0 -0.0</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (period) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l68"></a> t=4.0*(t%period)/period;
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (t<=-1.0) {
|
|
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (t<=-3.0)
|
|
<a name="l71"></a> </span><span class=cF1>return</span><span class=cF0> t+4.0;
|
|
<a name="l72"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l73"></a> </span><span class=cF1>return</span><span class=cF0> -2.0-t;
|
|
<a name="l74"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (t<=1.0)
|
|
<a name="l76"></a> </span><span class=cF1>return</span><span class=cF0> t;
|
|
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (t<=3.0)
|
|
<a name="l78"></a> </span><span class=cF1>return</span><span class=cF0> 2.0-t;
|
|
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF1>return</span><span class=cF0> t-4.0;
|
|
<a name="l81"></a> }
|
|
<a name="l82"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l83"></a> </span><span class=cF1>return</span><span class=cF0> 0.0;
|
|
<a name="l84"></a>}
|
|
<a name="l85"></a>
|
|
<a name="l86"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Snd/Music"</span><span class=cF0>
|
|
<a name="l87"></a>
|
|
<a name="l88"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CMusicGlbls</span><span class=cF0>
|
|
<a name="l89"></a>{
|
|
<a name="l90"></a> </span><span class=cF1>U8</span><span class=cF0> *cur_song;
|
|
<a name="l91"></a> </span><span class=cF9>CTask</span><span class=cF0> *cur_song_task;
|
|
<a name="l92"></a> </span><span class=cF9>I64</span><span class=cF0> octave;
|
|
<a name="l93"></a> </span><span class=cF1>F64</span><span class=cF0> note_len;
|
|
<a name="l94"></a> </span><span class=cF1>U8</span><span class=cF0> note_map[7];
|
|
<a name="l95"></a> </span><span class=cF1>Bool</span><span class=cF0> mute;
|
|
<a name="l96"></a> </span><span class=cF9>I64</span><span class=cF0> meter_top,meter_bottom;
|
|
<a name="l97"></a> </span><span class=cF1>F64</span><span class=cF0> tempo,stacatto_factor;
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> </span><span class=cF2>//If you wish to sync with a</span><span class=cF0>
|
|
<a name="l100"></a> </span><span class=cF2>//note in a Play() string. 0 is the start</span><span class=cF0>
|
|
<a name="l101"></a> </span><span class=cF9>I64</span><span class=cF0> play_note_num;
|
|
<a name="l102"></a>
|
|
<a name="l103"></a> </span><span class=cF1>F64</span><span class=cF0> tM_correction,last_Beat,last_tM;
|
|
<a name="l104"></a>} </span><span class=cFB>music</span><span class=cF0>={</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF3>NULL</span><span class=cF0>,4,1.0,</span><span class=cF7>{</span><span class=cF0>0,2,3,5,7,8,10</span><span class=cF7>}</span><span class=cF0>,</span><span class=cF3>FALSE</span><span class=cF0>,4,4,2.5,0.9,0,0,0,0};
|
|
<a name="l105"></a>
|
|
<a name="l106"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Snd/Music;Time/Seconds"</span><span class=cF0>
|
|
<a name="l107"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>tM</span><span class=cF0>()
|
|
<a name="l108"></a>{</span><span class=cF2>//Time in seconds synced to music subsystem.</span><span class=cF0>
|
|
<a name="l109"></a> </span><span class=cF1>return</span><span class=cF0> (</span><span class=cFB>cnts</span><span class=cF0>.jiffies+</span><span class=cFB>music</span><span class=cF0>.tM_correction)/</span><span class=cF3>JIFFY_FREQ</span><span class=cF0>;
|
|
<a name="l110"></a>}
|
|
<a name="l111"></a>
|
|
<a name="l112"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>Beat</span><span class=cF0>()
|
|
<a name="l113"></a>{</span><span class=cF2>//Time in music beats.</span><span class=cF0>
|
|
<a name="l114"></a> </span><span class=cF1>F64</span><span class=cF0> res,cur_tM;
|
|
<a name="l115"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
<a name="l116"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mp_cnt</span><span class=cF0>>1)
|
|
<a name="l118"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_TMBEAT</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l119"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
<a name="l120"></a> cur_tM=</span><span class=cF5>tM</span><span class=cF0>;
|
|
<a name="l121"></a> res=</span><span class=cFB>music</span><span class=cF0>.last_Beat;
|
|
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>music</span><span class=cF0>.tempo)
|
|
<a name="l123"></a> res+=(cur_tM-</span><span class=cFB>music</span><span class=cF0>.last_tM)*</span><span class=cFB>music</span><span class=cF0>.tempo;
|
|
<a name="l124"></a> </span><span class=cFB>music</span><span class=cF0>.last_tM=cur_tM;
|
|
<a name="l125"></a> </span><span class=cFB>music</span><span class=cF0>.last_Beat=res;
|
|
<a name="l126"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_TMBEAT</span><span class=cF0>],0);
|
|
<a name="l127"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
<a name="l128"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l129"></a>}
|
|
<a name="l130"></a>
|
|
<a name="l131"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Snd/Music"</span><span class=cF0>
|
|
<a name="l132"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>MusicSetOctave</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
|
|
<a name="l133"></a>{
|
|
<a name="l134"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
|
|
<a name="l135"></a> ch=*st++;
|
|
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0><=ch<=</span><span class=cF6>'9'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l137"></a> </span><span class=cFB>music</span><span class=cF0>.octave=ch-</span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l138"></a> ch=*st++;
|
|
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l140"></a> </span><span class=cF1>return</span><span class=cF0> --st;
|
|
<a name="l141"></a>}
|
|
<a name="l142"></a>
|
|
<a name="l143"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>MusicSetMeter</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
|
|
<a name="l144"></a>{
|
|
<a name="l145"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
|
|
<a name="l146"></a> ch=*st++;
|
|
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (ch==</span><span class=cF6>'M'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l148"></a> ch=*st++;
|
|
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0><=ch<=</span><span class=cF6>'9'</span><span class=cF0>) {
|
|
<a name="l150"></a> </span><span class=cFB>music</span><span class=cF0>.meter_top=ch-</span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l151"></a> ch=*st++;
|
|
<a name="l152"></a> }
|
|
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (ch==</span><span class=cF6>'/'</span><span class=cF0>)
|
|
<a name="l154"></a> ch=*st++;
|
|
<a name="l155"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'0'</span><span class=cF0><=ch<=</span><span class=cF6>'9'</span><span class=cF0>) {
|
|
<a name="l156"></a> </span><span class=cFB>music</span><span class=cF0>.meter_bottom=ch-</span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l157"></a> ch=*st++;
|
|
<a name="l158"></a> }
|
|
<a name="l159"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l160"></a> </span><span class=cF1>return</span><span class=cF0> --st;
|
|
<a name="l161"></a>}
|
|
<a name="l162"></a>
|
|
<a name="l163"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>MusicSetNoteLen</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st)
|
|
<a name="l164"></a>{
|
|
<a name="l165"></a> </span><span class=cF1>Bool</span><span class=cF0> cont=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l166"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l167"></a> </span><span class=cF1>switch</span><span class=cF0> (*st++) {
|
|
<a name="l168"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'w'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=4.0; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l169"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'h'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=2.0; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l170"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'q'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=1.0; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l171"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'e'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=0.5; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l172"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'s'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=0.25; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l173"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=2.0*</span><span class=cFB>music</span><span class=cF0>.note_len/3.0; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l174"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'.'</span><span class=cF0>: </span><span class=cFB>music</span><span class=cF0>.note_len=1.5*</span><span class=cFB>music</span><span class=cF0>.note_len; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l175"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l176"></a> st--;
|
|
<a name="l177"></a> cont=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l178"></a> }
|
|
<a name="l179"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (cont);
|
|
<a name="l180"></a> </span><span class=cF1>return</span><span class=cF0> st;
|
|
<a name="l181"></a>}
|
|
<a name="l182"></a>
|
|
<a name="l183"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>I8</span><span class=cF0> </span><span class=cF5>Note2Ona</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> note,</span><span class=cF9>I64</span><span class=cF0> octave=4)
|
|
<a name="l184"></a>{</span><span class=cF2>//Note to ona. Mid C is ona=51, note=3 and octave=4.</span><span class=cF0>
|
|
<a name="l185"></a> </span><span class=cF1>if</span><span class=cF0> (note<3)
|
|
<a name="l186"></a> </span><span class=cF1>return</span><span class=cF0> (octave+1)*12+note;
|
|
<a name="l187"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l188"></a> </span><span class=cF1>return</span><span class=cF0> octave*12+note;
|
|
<a name="l189"></a>}
|
|
<a name="l190"></a>
|
|
<a name="l191"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>I8</span><span class=cF0> </span><span class=cF5>Ona2Note</span><span class=cF0>(</span><span class=cF1>I8</span><span class=cF0> ona)
|
|
<a name="l192"></a>{</span><span class=cF2>//Ona to note in octave. Mid C is ona=51, note=3 and octave=4.</span><span class=cF0>
|
|
<a name="l193"></a> </span><span class=cF1>return</span><span class=cF0> ona%12;
|
|
<a name="l194"></a>}
|
|
<a name="l195"></a>
|
|
<a name="l196"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>I8</span><span class=cF0> </span><span class=cF5>Ona2Octave</span><span class=cF0>(</span><span class=cF1>I8</span><span class=cF0> ona)
|
|
<a name="l197"></a>{</span><span class=cF2>//Ona to octave. Mid C is ona=51, note=3 and octave=4.</span><span class=cF0>
|
|
<a name="l198"></a> </span><span class=cF9>I64</span><span class=cF0> note=ona%12,octave=ona/12;
|
|
<a name="l199"></a> </span><span class=cF1>if</span><span class=cF0> (note<3)
|
|
<a name="l200"></a> </span><span class=cF1>return</span><span class=cF0> octave-1;
|
|
<a name="l201"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l202"></a> </span><span class=cF1>return</span><span class=cF0> octave;
|
|
<a name="l203"></a>}
|
|
<a name="l204"></a>
|
|
<a name="l205"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *st,</span><span class=cF1>U8</span><span class=cF0> *words=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l206"></a>{</span><span class=cF2>/* Notes are entered with a capital letter.</span><span class=cF0>
|
|
<a name="l207"></a>
|
|
<a name="l208"></a></span><span class=cF2>Octaves are entered with a digit and</span><span class=cF0>
|
|
<a name="l209"></a></span><span class=cF2>stay set until changed. Mid C is octave 4.</span><span class=cF0>
|
|
<a name="l210"></a>
|
|
<a name="l211"></a></span><span class=cF2>Durations are entered with</span><span class=cF0>
|
|
<a name="l212"></a></span><span class=cF2>'w' whole note</span><span class=cF0>
|
|
<a name="l213"></a></span><span class=cF2>'h' half note</span><span class=cF0>
|
|
<a name="l214"></a></span><span class=cF2>'q' quarter note</span><span class=cF0>
|
|
<a name="l215"></a></span><span class=cF2>'e' eighth note</span><span class=cF0>
|
|
<a name="l216"></a></span><span class=cF2>'t' sets to 2/3rds the current duration</span><span class=cF0>
|
|
<a name="l217"></a></span><span class=cF2>'.' sets to 1.5 times the current duration</span><span class=cF0>
|
|
<a name="l218"></a></span><span class=cF2>durations stay set until changed.</span><span class=cF0>
|
|
<a name="l219"></a>
|
|
<a name="l220"></a></span><span class=cF2>'(' tie, placed before the note to be extended</span><span class=cF0>
|
|
<a name="l221"></a></span><span class=cF4>
|
|
<a name="l222"></a></span><a href="/Wb/Adam/ASnd.HC.HTML#l88"><span class=cF4>music.meter_top</span></a><span class=cF2>,</span><a href="/Wb/Adam/ASnd.HC.HTML#l88"><span class=cF4>music.meter_bottom</span></a><span class=cF2> is set with</span><span class=cF0>
|
|
<a name="l223"></a></span><span class=cF2>"M3/4"</span><span class=cF0>
|
|
<a name="l224"></a></span><span class=cF2>"M4/4"</span><span class=cF0>
|
|
<a name="l225"></a></span><span class=cF2>etc.</span><span class=cF0>
|
|
<a name="l226"></a>
|
|
<a name="l227"></a></span><span class=cF2>Sharp and flat are done with '#' or 'b'.</span><span class=cF0>
|
|
<a name="l228"></a>
|
|
<a name="l229"></a></span><span class=cF2>The var music.stacatto_factor can</span><span class=cF0>
|
|
<a name="l230"></a></span><span class=cF2>be set to a range from 0.0 to 1.0.</span><span class=cF0>
|
|
<a name="l231"></a>
|
|
<a name="l232"></a></span><span class=cF2>The var music.tempo is quarter-notes</span><span class=cF0>
|
|
<a name="l233"></a></span><span class=cF2>per second. It defaults to</span><span class=cF0>
|
|
<a name="l234"></a></span><span class=cF2>2.5 and gets faster when bigger.</span><span class=cF0>
|
|
<a name="l235"></a></span><span class=cF2>*/</span><span class=cF0>
|
|
<a name="l236"></a> </span><span class=cF1>U8</span><span class=cF0> *word,*last_st;
|
|
<a name="l237"></a> </span><span class=cF9>I64</span><span class=cF0> note,octave,i=0,ona,timeout_val,timeout_val2;
|
|
<a name="l238"></a> </span><span class=cF1>Bool</span><span class=cF0> tie;
|
|
<a name="l239"></a> </span><span class=cF1>F64</span><span class=cF0> d,on_jiffies,off_jiffies;
|
|
<a name="l240"></a> </span><span class=cFB>music</span><span class=cF0>.play_note_num=0;
|
|
<a name="l241"></a> </span><span class=cF1>while</span><span class=cF0> (*st) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l242"></a> timeout_val=</span><span class=cFB>cnts</span><span class=cF0>.jiffies;
|
|
<a name="l243"></a> tie=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l244"></a>
|
|
<a name="l245"></a> </span><span class=cF1>do</span><span class=cF0> {
|
|
<a name="l246"></a> last_st=st;
|
|
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (*st==</span><span class=cF6>'('</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l248"></a> tie=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l249"></a> st++;
|
|
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l251"></a> st=</span><span class=cF5>MusicSetMeter</span><span class=cF0>(st);
|
|
<a name="l252"></a> st=</span><span class=cF5>MusicSetOctave</span><span class=cF0>(st);
|
|
<a name="l253"></a> st=</span><span class=cF5>MusicSetNoteLen</span><span class=cF0>(st);
|
|
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l255"></a> } </span><span class=cF1>while</span><span class=cF0> (st!=last_st);
|
|
<a name="l256"></a>
|
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (!*st) </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l258"></a> note=*st++-</span><span class=cF6>'A'</span><span class=cF0>;
|
|
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (note<7) {
|
|
<a name="l260"></a> note=</span><span class=cFB>music</span><span class=cF0>.note_map[note];
|
|
<a name="l261"></a> octave=</span><span class=cFB>music</span><span class=cF0>.octave;
|
|
<a name="l262"></a> </span><span class=cF1>if</span><span class=cF0> (*st==</span><span class=cF6>'b'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l263"></a> note--;
|
|
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (note==2)
|
|
<a name="l265"></a> octave--;
|
|
<a name="l266"></a> st++;
|
|
<a name="l267"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (*st==</span><span class=cF6>'#'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l268"></a> note++;
|
|
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (note==3)
|
|
<a name="l270"></a> octave++;
|
|
<a name="l271"></a> st++;
|
|
<a name="l272"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l273"></a> ona=</span><span class=cF5>Note2Ona</span><span class=cF0>(note,octave);
|
|
<a name="l274"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l275"></a> ona=0;
|
|
<a name="l276"></a> </span><span class=cF1>if</span><span class=cF0> (words && </span><span class=cF7>(</span><span class=cF0>word=</span><span class=cF5>LstSub</span><span class=cF0>(i++,words)</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>word,</span><span class=cF6>" "</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l277"></a> </span><span class=cF6>"%s"</span><span class=cF0>,word;
|
|
<a name="l278"></a>
|
|
<a name="l279"></a> d=</span><span class=cF3>JIFFY_FREQ</span><span class=cF0>*</span><span class=cFB>music</span><span class=cF0>.note_len/</span><span class=cFB>music</span><span class=cF0>.tempo;
|
|
<a name="l280"></a> on_jiffies =d*</span><span class=cFB>music</span><span class=cF0>.stacatto_factor;
|
|
<a name="l281"></a> off_jiffies =d*(1.0-</span><span class=cFB>music</span><span class=cF0>.stacatto_factor);
|
|
<a name="l282"></a>
|
|
<a name="l283"></a> timeout_val+=on_jiffies;
|
|
<a name="l284"></a> timeout_val2=timeout_val+off_jiffies;
|
|
<a name="l285"></a>
|
|
<a name="l286"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>music</span><span class=cF0>.mute)
|
|
<a name="l287"></a> </span><span class=cF5>Snd</span><span class=cF0>(ona);
|
|
<a name="l288"></a> </span><span class=cF5>SleepUntil</span><span class=cF0>(timeout_val);
|
|
<a name="l289"></a> </span><span class=cFB>music</span><span class=cF0>.tM_correction+=on_jiffies-</span><span class=cF5>ToI64</span><span class=cF0>(on_jiffies);
|
|
<a name="l290"></a>
|
|
<a name="l291"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFB>music</span><span class=cF0>.mute && !tie)
|
|
<a name="l292"></a> </span><span class=cF5>Snd</span><span class=cF0>;
|
|
<a name="l293"></a> </span><span class=cF5>SleepUntil</span><span class=cF0>(timeout_val2);
|
|
<a name="l294"></a> </span><span class=cFB>music</span><span class=cF0>.tM_correction+=off_jiffies-</span><span class=cF5>ToI64</span><span class=cF0>(off_jiffies);
|
|
<a name="l295"></a>
|
|
<a name="l296"></a> </span><span class=cFB>music</span><span class=cF0>.play_note_num++;
|
|
<a name="l297"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l298"></a>}
|
|
<a name="l299"></a>
|
|
<a name="l300"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>MusicSettingsRst</span><span class=cF0>()
|
|
<a name="l301"></a>{
|
|
<a name="l302"></a> </span><span class=cFB>music</span><span class=cF0>.play_note_num=0;
|
|
<a name="l303"></a> </span><span class=cFB>music</span><span class=cF0>.stacatto_factor=0.9;
|
|
<a name="l304"></a> </span><span class=cFB>music</span><span class=cF0>.tempo=2.5;
|
|
<a name="l305"></a> </span><span class=cFB>music</span><span class=cF0>.octave=4;
|
|
<a name="l306"></a> </span><span class=cFB>music</span><span class=cF0>.note_len=1.0;
|
|
<a name="l307"></a> </span><span class=cFB>music</span><span class=cF0>.meter_top=4;
|
|
<a name="l308"></a> </span><span class=cFB>music</span><span class=cF0>.meter_bottom=4;
|
|
<a name="l309"></a> </span><span class=cF5>SndRst</span><span class=cF0>;
|
|
<a name="l310"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
<a name="l311"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mp_cnt</span><span class=cF0>>1)
|
|
<a name="l313"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_TMBEAT</span><span class=cF0>],0</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l314"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
<a name="l315"></a> </span><span class=cFB>music</span><span class=cF0>.last_tM=</span><span class=cF5>tM</span><span class=cF0>;
|
|
<a name="l316"></a> </span><span class=cFB>music</span><span class=cF0>.last_Beat=0.0;
|
|
<a name="l317"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_TMBEAT</span><span class=cF0>],0);
|
|
<a name="l318"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
<a name="l319"></a>}
|
|
<a name="l320"></a>
|
|
<a name="l321"></a></span><span class=cF5>MusicSettingsRst</span><span class=cF0>;
|
|
<a name="l322"></a>
|
|
<a name="l323"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CurSongTask</span><span class=cF0>()
|
|
<a name="l324"></a>{
|
|
<a name="l325"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb=&</span><span class=cF5>SndTaskEndCB</span><span class=cF0>;
|
|
<a name="l326"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l327"></a> </span><span class=cF5>Play</span><span class=cF0>(</span><span class=cFB>music</span><span class=cF0>.cur_song);
|
|
<a name="l328"></a>}
|
|
<a name="l329"></a>
|
|
<a name="l330"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Snd"</span><span class=cF0>
|
|
<a name="l331"></a>
|
|
<a name="l332"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SE_NOISE</span><span class=cF0> 0
|
|
<a name="l333"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SE_SWEEP</span><span class=cF0> 1
|
|
<a name="l334"></a>
|
|
<a name="l335"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CSoundEffectFrame</span><span class=cF0>
|
|
<a name="l336"></a>{
|
|
<a name="l337"></a> </span><span class=cF9>I32</span><span class=cF0> type;
|
|
<a name="l338"></a> </span><span class=cF1>I8</span><span class=cF0> ona1,ona2;
|
|
<a name="l339"></a> </span><span class=cF1>F64</span><span class=cF0> duration;
|
|
<a name="l340"></a>};
|
|
<a name="l341"></a>
|
|
<a name="l342"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SoundEffectEndTaskCB</span><span class=cF0>()
|
|
<a name="l343"></a>{
|
|
<a name="l344"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>FramePtr</span><span class=cF7>(</span><span class=cF6>"CSoundEffectFrame"</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l345"></a> </span><span class=cFB>music</span><span class=cF0>.mute--;
|
|
<a name="l346"></a> </span><span class=cF5>SndTaskEndCB</span><span class=cF0>;
|
|
<a name="l347"></a>}
|
|
<a name="l348"></a>
|
|
<a name="l349"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SoundEffectTask</span><span class=cF0>(</span><span class=cF9>CSoundEffectFrame</span><span class=cF0> *ns)
|
|
<a name="l350"></a>{
|
|
<a name="l351"></a> </span><span class=cF9>I64</span><span class=cF0> i,ona;
|
|
<a name="l352"></a> </span><span class=cF1>F64</span><span class=cF0> t0=</span><span class=cF5>tS</span><span class=cF0>,t,timeout=t0+ns->duration;
|
|
<a name="l353"></a> </span><span class=cF5>FramePtrAdd</span><span class=cF0>(</span><span class=cF6>"CSoundEffectFrame"</span><span class=cF0>,ns);
|
|
<a name="l354"></a> </span><span class=cF5>Fs</span><span class=cF0>->task_end_cb=&</span><span class=cF5>SoundEffectEndTaskCB</span><span class=cF0>;
|
|
<a name="l355"></a> </span><span class=cF1>switch</span><span class=cF0> (ns->type) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l356"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SE_NOISE</span><span class=cF0>:
|
|
<a name="l357"></a> i=</span><span class=cF5>MaxI64</span><span class=cF0>(ns->ona2-ns->ona1,1);
|
|
<a name="l358"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0><timeout) {
|
|
<a name="l359"></a> ona=</span><span class=cF5>RandU16</span><span class=cF0>%i+ns->ona1;
|
|
<a name="l360"></a> </span><span class=cF5>Snd</span><span class=cF0>(ona);
|
|
<a name="l361"></a> t=</span><span class=cF5>Clamp</span><span class=cF0>(3000.0/</span><span class=cF5>Ona2Freq</span><span class=cF7>(</span><span class=cF0>ona</span><span class=cF7>)</span><span class=cF0>,1.0,50.0);
|
|
<a name="l362"></a> </span><span class=cF1>if</span><span class=cF0> (t+</span><span class=cF5>tS</span><span class=cF0>>timeout)
|
|
<a name="l363"></a> t=timeout-</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l364"></a> </span><span class=cF5>Sleep</span><span class=cF0>(t);
|
|
<a name="l365"></a> }
|
|
<a name="l366"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l367"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SE_SWEEP</span><span class=cF0>:
|
|
<a name="l368"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0><timeout) {
|
|
<a name="l369"></a> t=(</span><span class=cF5>tS</span><span class=cF0>-t0)/ns->duration;
|
|
<a name="l370"></a> ona=(1.0-t)*ns->ona1+t*ns->ona2;
|
|
<a name="l371"></a> </span><span class=cF5>Snd</span><span class=cF0>(ona);
|
|
<a name="l372"></a> t=</span><span class=cF5>Clamp</span><span class=cF0>(3000.0/</span><span class=cF5>Ona2Freq</span><span class=cF7>(</span><span class=cF0>ona</span><span class=cF7>)</span><span class=cF0>,1.0,50.0);
|
|
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (t+</span><span class=cF5>tS</span><span class=cF0>>timeout)
|
|
<a name="l374"></a> t=timeout-</span><span class=cF5>tS</span><span class=cF0>;
|
|
<a name="l375"></a> </span><span class=cF5>Sleep</span><span class=cF0>(t);
|
|
<a name="l376"></a> }
|
|
<a name="l377"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l378"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l379"></a>}
|
|
<a name="l380"></a>
|
|
<a name="l381"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>Noise</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> mS,</span><span class=cF1>F64</span><span class=cF0> min_ona,</span><span class=cF1>F64</span><span class=cF0> max_ona)
|
|
<a name="l382"></a>{</span><span class=cF2>//Make white noise for given number of mS.</span><span class=cF0>
|
|
<a name="l383"></a> </span><span class=cF9>CSoundEffectFrame</span><span class=cF0> *ns;
|
|
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (mS>0) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l385"></a> ns=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSoundEffectFrame</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l386"></a> ns->type=</span><span class=cF3>SE_NOISE</span><span class=cF0>;
|
|
<a name="l387"></a> ns->duration=mS/1000.0;
|
|
<a name="l388"></a> ns->ona1=min_ona;
|
|
<a name="l389"></a> ns->ona2=max_ona;
|
|
<a name="l390"></a> </span><span class=cFB>music</span><span class=cF0>.mute++;
|
|
<a name="l391"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Spawn</span><span class=cF0>(&</span><span class=cF5>SoundEffectTask</span><span class=cF0>,ns,</span><span class=cF6>"Noise"</span><span class=cF0>,,</span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l392"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l393"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l394"></a>}
|
|
<a name="l395"></a>
|
|
<a name="l396"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>Sweep</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> mS,</span><span class=cF1>F64</span><span class=cF0> ona1,</span><span class=cF1>F64</span><span class=cF0> ona2)
|
|
<a name="l397"></a>{</span><span class=cF2>//Sweep through freq range in given number of mS.</span><span class=cF0>
|
|
<a name="l398"></a> </span><span class=cF9>CSoundEffectFrame</span><span class=cF0> *ns;
|
|
<a name="l399"></a> </span><span class=cF1>if</span><span class=cF0> (mS>0) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l400"></a> ns=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CSoundEffectFrame</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l401"></a> ns->type=</span><span class=cF3>SE_SWEEP</span><span class=cF0>;
|
|
<a name="l402"></a> ns->duration=mS/1000.0;
|
|
<a name="l403"></a> ns->ona1=ona1;
|
|
<a name="l404"></a> ns->ona2=ona2;
|
|
<a name="l405"></a> </span><span class=cFB>music</span><span class=cF0>.mute++;
|
|
<a name="l406"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Spawn</span><span class=cF0>(&</span><span class=cF5>SoundEffectTask</span><span class=cF0>,ns,</span><span class=cF6>"Noise"</span><span class=cF0>,,</span><span class=cF5>Fs</span><span class=cF0>);
|
|
<a name="l407"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l408"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l409"></a>}
|
|
</span></pre></body>
|
|
</html>
|