2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-09-22 04:45:45 +01:00
< meta name = "generator" content = "ZealOS V1.01" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
2021-07-29 03:20:15 +01:00
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
2021-07-03 05:07:57 +01:00
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = "font-family:monospace;font-size:12pt" >
2021-07-03 05:07:57 +01:00
< a name = "l1" > < / a > < span class = cF0 > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Sound" < / 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 > SoundTaskEndCB< / span > < span class = cF0 > ()
< a name = "l3" > < / a > {< / span > < span class = cF2 > //Will turn-off sound when a task gets killed.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l4" > < / a > < / span > < span class = cF5 > Sound< / span > < span class = cF0 > ;
< a name = "l5" > < / a > < / span > < span class = cF5 > Exit< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< 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 > " Sound/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 >
2021-07-04 23:11:34 +01:00
< a name = "l11" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (period)
< a name = "l12" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l13" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t > = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l14" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > t % period / period;
< a name = "l15" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l16" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > + t % period / period;
< a name = "l17" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l18" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l19" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l20" > < / a > }
< a name = "l21" > < / a >
< a name = "l22" > < / 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 = "l23" > < / a > {< / span > < span class = cF2 > //Plus& Minus Sawtooth. 1.0 - -1.0 think " Sin" < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l24" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (period)
< a name = "l25" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l26" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t > = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l27" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * (t % period / period) - < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l28" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l29" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * (t % period / period) + < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l30" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l31" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l32" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l33" > < / a > }
< a name = "l34" > < / a >
< a name = "l35" > < / 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 = "l36" > < / a > {< / span > < span class = cF2 > //Cawtooth. 1.0 - 0.0 think " (Cos+1)/2" < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l37" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (period)
< a name = "l38" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l39" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t > = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l40" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > - t % period / period;
< a name = "l41" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l42" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > -(t % period) / period;
< a name = "l43" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l44" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l45" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l46" > < / a > }
< a name = "l47" > < / a >
< a name = "l48" > < / 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 = "l49" > < / a > {< / span > < span class = cF2 > //Plus& Minus Cawtooth. 1.0 - -1.0 think " Cos" < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l50" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (period)
< a name = "l51" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l52" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t > = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l53" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > -< / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * (t % period / period) + < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l54" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l55" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > -< / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * (t % period / period) - < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l56" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l57" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l58" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l59" > < / a > }
< a name = "l60" > < / a >
< a name = "l61" > < / 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 = "l62" > < / a > {< / span > < span class = cF2 > //Triangle waveform. 0.0 - 1.0 - 0.0< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l63" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (period)
< a name = "l64" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l65" > < / a > t = < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * (< / 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 = "l66" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t < = < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l67" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > t;
< a name = "l68" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l69" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > - t;
< a name = "l70" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l71" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l72" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l73" > < / a > }
< a name = "l74" > < / a >
< a name = "l75" > < / 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 = "l76" > < / a > {< / span > < span class = cF2 > //Plus& Minus Triangle waveform. 0.0 - 1.0 - 0.0 - -1.0 -0.0< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l77" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (period)
< a name = "l78" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l79" > < / a > t = < / span > < span class = cFE > 4< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * (t % period) / period;
< a name = "l80" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t < = -< / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l81" > < / a > {
< a name = "l82" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t < = -< / span > < span class = cFE > 3< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l83" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > t + < / span > < span class = cFE > 4< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l84" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l85" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > -< / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > - t;
< a name = "l86" > < / a > }
< a name = "l87" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l88" > < / a > {
< a name = "l89" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t < = < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l90" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > t;
< a name = "l91" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t < = < / span > < span class = cFE > 3< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l92" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > - t;
< a name = "l93" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l94" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > t -< / span > < span class = cFE > 4< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l95" > < / a > }
< a name = "l96" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l97" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l98" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l99" > < / a > }
< a name = "l100" > < / a >
< a name = "l101" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Sound/Music" < / span > < span class = cF0 >
< a name = "l102" > < / a >
< a name = "l103" > < / a > < / span > < span class = cF1 > public< / span > < span class = cF0 > < / span > < span class = cF1 > class< / span > < span class = cF0 > < / span > < span class = cF9 > CMusicGlobals< / span > < span class = cF0 >
< a name = "l104" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l105" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *cur_song;
< a name = "l106" > < / a > < / span > < span class = cF9 > CTask< / span > < span class = cF0 > *cur_song_task;
< a name = "l107" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > octave;
< a name = "l108" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > note_len;
< a name = "l109" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > note_map[< / span > < span class = cFE > 7< / span > < span class = cF0 > ];
< a name = "l110" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > mute;
< a name = "l111" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > meter_top, meter_bottom;
< a name = "l112" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > tempo, stacatto_factor;
2021-07-03 05:07:57 +01:00
< a name = "l113" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l114" > < / a > < / span > < span class = cF2 > //If you wish to sync with a< / span > < span class = cF0 >
< a name = "l115" > < / a > < / span > < span class = cF2 > //note in a Play() string.< / span > < span class = cF0 > < / span > < span class = cF2 > 0 is the start< / span > < span class = cF0 >
< a name = "l116" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > play_note_num;
2021-07-03 05:07:57 +01:00
< a name = "l117" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l118" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > tM_correction, last_Beat, last_tM;
2021-07-03 05:07:57 +01:00
< a name = "l119" > < / a >
< a name = "l120" > < / 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 > , < / span > < span class = cFE > 4< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cF7 > {< / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 2< / span > < span class = cF0 > , < / span > < span class = cFE > 3< / span > < span class = cF0 > , < / span > < span class = cFE > 5< / span > < span class = cF0 > , < / span > < span class = cFE > 7< / span > < span class = cF0 > , < / span > < span class = cFE > 8< / span > < span class = cF0 > , < / span > < span class = cFE > 10< / span > < span class = cF7 > }< / span > < span class = cF0 > , < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > , < / span > < span class = cFE > 4< / span > < span class = cF0 > , < / span > < span class = cFE > 4< / span > < span class = cF0 > , < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 5< / span > < span class = cF0 > , < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 9< / span > < span class = cF0 > , < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 0< / span > < span class = cF0 > };
< a name = "l121" > < / a >
< a name = "l122" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Sound/Music;Time/Seconds" < / span > < span class = cF0 >
< a name = "l123" > < / 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 = "l124" > < / a > {< / span > < span class = cF2 > //Time in seconds synced to music subsystem.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l125" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > (< / span > < span class = cFB > counts< / 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 > ;
2021-07-03 05:07:57 +01:00
< a name = "l126" > < / a > }
< a name = "l127" > < / a >
< a name = "l128" > < / 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 = "l129" > < / a > {< / span > < span class = cF2 > //Time in music beats.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l130" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > res, cur_tM;
2021-07-03 05:07:57 +01:00
< a name = "l131" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l132" > < / a > < / span > < span class = cF1 > PUSHFD< / span > < span class = cF0 >
< a name = "l133" > < / a > < / span > < span class = cF1 > CLI< / span > < span class = cF0 >
< a name = "l134" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFB > mp_count< / span > < span class = cF0 > > < / span > < span class = cFE > 1< / span > < span class = cF0 > )
< a name = "l135" > < / 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 > ], < / span > < span class = cFE > 0< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l136" > < / a > < / span > < span class = cF1 > PAUSE< / span > < span class = cF0 >
< a name = "l137" > < / a > cur_tM = < / span > < span class = cF5 > tM< / span > < span class = cF0 > ;
< a name = "l138" > < / a > res = < / span > < span class = cFB > music< / span > < span class = cF0 > .last_Beat;
< a name = "l139" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFB > music< / span > < span class = cF0 > .tempo)
< a name = "l140" > < / 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 = "l141" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .last_tM = cur_tM;
< a name = "l142" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .last_Beat = res;
< a name = "l143" > < / 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 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l144" > < / a > < / span > < span class = cF1 > POPFD< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l145" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l146" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > res;
2021-07-03 05:07:57 +01:00
< a name = "l147" > < / a > }
< a name = "l148" > < / a >
< a name = "l149" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Sound/Music" < / span > < span class = cF0 >
< a name = "l150" > < / 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 = "l151" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l152" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > ch;
2021-07-03 05:07:57 +01:00
< a name = "l153" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l154" > < / a > ch = *st++;
< a name = "l155" > < / 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 > )
< a name = "l156" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l157" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .octave = ch - < / span > < span class = cF6 > '0'< / span > < span class = cF0 > ;
< a name = "l158" > < / a > ch = *st++;
< a name = "l159" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l160" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l161" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > --st;
2021-07-03 05:07:57 +01:00
< a name = "l162" > < / a > }
< a name = "l163" > < / a >
< a name = "l164" > < / 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 = "l165" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l166" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > ch;
2021-07-03 05:07:57 +01:00
< a name = "l167" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l168" > < / a > ch = *st++;
< a name = "l169" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (ch == < / span > < span class = cF6 > 'M'< / span > < span class = cF0 > )
< a name = "l170" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l171" > < / a > ch = *st++;
< a name = "l172" > < / 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 = "l173" > < / a > {
< a name = "l174" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .meter_top = ch - < / span > < span class = cF6 > '0'< / span > < span class = cF0 > ;
< a name = "l175" > < / a > ch = *st++;
< a name = "l176" > < / a > }
< a name = "l177" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (ch == < / span > < span class = cF6 > '/'< / span > < span class = cF0 > )
< a name = "l178" > < / a > ch = *st++;
< a name = "l179" > < / 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 = "l180" > < / a > {
< a name = "l181" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .meter_bottom = ch - < / span > < span class = cF6 > '0'< / span > < span class = cF0 > ;
< a name = "l182" > < / a > ch = *st++;
< a name = "l183" > < / a > }
< a name = "l184" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l185" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l186" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > --st;
2021-07-03 05:07:57 +01:00
< a name = "l187" > < / a > }
< a name = "l188" > < / a >
< a name = "l189" > < / 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 = "l190" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l191" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > cont=< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l192" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l193" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l194" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l195" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (*st++)
< a name = "l196" > < / a > {
< a name = "l197" > < / 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 = < / span > < span class = cFE > 4< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l198" > < / 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 = < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l199" > < / 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 = < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l200" > < / 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 = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 5< / span > < span class = cF0 > ; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l201" > < / 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 = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 25< / span > < span class = cF0 > ; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l202" > < / 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 = < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > * < / span > < span class = cFB > music< / span > < span class = cF0 > .note_len / < / span > < span class = cFE > 3< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l203" > < / 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 = < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 5< / span > < span class = cF0 > * < / span > < span class = cFB > music< / span > < span class = cF0 > .note_len; < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l204" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l205" > < / a > < / span > < span class = cF1 > default< / span > < span class = cF0 > :
< a name = "l206" > < / a > st--;
< a name = "l207" > < / a > cont = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
< a name = "l208" > < / a > }
< a name = "l209" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l210" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (cont);
2021-07-03 05:07:57 +01:00
< a name = "l211" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l212" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > st;
2021-07-03 05:07:57 +01:00
< a name = "l213" > < / a > }
< a name = "l214" > < / a >
< a name = "l215" > < / 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=< / span > < span class = cFE > 4< / span > < span class = cF0 > )
< a name = "l216" > < / a > {< / span > < span class = cF2 > //Note to ona. Mid C is ona=51, note=3 and octave=4.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l217" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (note < < / span > < span class = cFE > 3< / span > < span class = cF0 > )
< a name = "l218" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > (octave + < / span > < span class = cFE > 1< / span > < span class = cF0 > ) * < / span > < span class = cFE > 12< / span > < span class = cF0 > + note;
< a name = "l219" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l220" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > octave * < / span > < span class = cFE > 12< / span > < span class = cF0 > + note;
2021-07-03 05:07:57 +01:00
< a name = "l221" > < / a > }
< a name = "l222" > < / a >
< a name = "l223" > < / 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 = "l224" > < / a > {< / span > < span class = cF2 > //Ona to note in octave. Mid C is ona=51, note=3 and octave=4.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l225" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > ona % < / span > < span class = cFE > 12< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l226" > < / a > }
< a name = "l227" > < / a >
< a name = "l228" > < / 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 = "l229" > < / a > {< / span > < span class = cF2 > //Ona to octave. Mid C is ona=51, note=3 and octave=4.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l230" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > note = ona % < / span > < span class = cFE > 12< / span > < span class = cF0 > , octave = ona / < / span > < span class = cFE > 12< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l231" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l232" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (note < < / span > < span class = cFE > 3< / span > < span class = cF0 > )
< a name = "l233" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > octave - < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l234" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l235" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > octave;
2021-07-03 05:07:57 +01:00
< a name = "l236" > < / a > }
< a name = "l237" > < / a >
< a name = "l238" > < / 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 = "l239" > < / a > {< / span > < span class = cF2 > /* Notes are entered with a capital letter.< / span > < span class = cF0 >
< a name = "l240" > < / a >
< a name = "l241" > < / a > < / span > < span class = cF2 > Octaves are entered with a digit and< / span > < span class = cF0 >
< a name = "l242" > < / a > < / span > < span class = cF2 > stay set until changed. Mid C is octave 4.< / span > < span class = cF0 >
< a name = "l243" > < / a >
< a name = "l244" > < / a > < / span > < span class = cF2 > Durations are entered with< / span > < span class = cF0 >
< a name = "l245" > < / a > < / span > < span class = cF2 > 'w' whole note< / span > < span class = cF0 >
< a name = "l246" > < / a > < / span > < span class = cF2 > 'h' half note< / span > < span class = cF0 >
< a name = "l247" > < / a > < / span > < span class = cF2 > 'q' quarter note< / span > < span class = cF0 >
< a name = "l248" > < / a > < / span > < span class = cF2 > 'e' eighth note< / span > < span class = cF0 >
< a name = "l249" > < / a > < / span > < span class = cF2 > 't' sets to 2/3rds the current duration< / span > < span class = cF0 >
< a name = "l250" > < / a > < / span > < span class = cF2 > '.' sets to 1.5 times the current duration< / span > < span class = cF0 >
< a name = "l251" > < / a > < / span > < span class = cF2 > durations stay set until changed.< / span > < span class = cF0 >
< a name = "l252" > < / a >
< a name = "l253" > < / a > < / span > < span class = cF2 > '(' tie, placed before the note to be extended< / span > < span class = cF0 >
< a name = "l254" > < / a > < / span > < span class = cF4 >
2021-07-26 20:29:49 +01:00
< a name = "l255" > < / a > < / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/Sound.CC.html#l103" > < span class = cF4 > music.meter_top< / span > < / a > < span class = cF2 > ,< / span > < a href = "https://zeal-operating-system.github.io/ZealOS/System/Sound.CC.html#l103" > < span class = cF4 > music.meter_bottom< / span > < / a > < span class = cF2 > is set with< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l256" > < / a > < / span > < span class = cF2 > " M3/4" < / span > < span class = cF0 >
< a name = "l257" > < / a > < / span > < span class = cF2 > " M4/4" < / span > < span class = cF0 >
< a name = "l258" > < / a > < / span > < span class = cF2 > etc.< / span > < span class = cF0 >
< a name = "l259" > < / a >
< a name = "l260" > < / a > < / span > < span class = cF2 > Sharp and flat are done with '#' or 'b'.< / span > < span class = cF0 >
< a name = "l261" > < / a >
< a name = "l262" > < / a > < / span > < span class = cF2 > The var music.stacatto_factor can< / span > < span class = cF0 >
< a name = "l263" > < / a > < / span > < span class = cF2 > be set to a range from 0.0 to 1.0.< / span > < span class = cF0 >
< a name = "l264" > < / a >
< a name = "l265" > < / a > < / span > < span class = cF2 > The var music.tempo is quarter-notes< / span > < span class = cF0 >
< a name = "l266" > < / a > < / span > < span class = cF2 > per second. It defaults to< / span > < span class = cF0 >
< a name = "l267" > < / a > < / span > < span class = cF2 > 2.5 and gets faster when bigger.< / span > < span class = cF0 >
< a name = "l268" > < / a > < / span > < span class = cF2 > */< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l269" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *word, *last_st;
< a name = "l270" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > note, octave, i = < / span > < span class = cFE > 0< / span > < span class = cF0 > , ona, timeout_val, timeout_val2;
< a name = "l271" > < / a > < / span > < span class = cF1 > Bool< / span > < span class = cF0 > tie;
< a name = "l272" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > d, on_jiffies, off_jiffies;
2021-07-03 05:07:57 +01:00
< a name = "l273" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l274" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .play_note_num = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l275" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (*st)
< a name = "l276" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l277" > < / a > timeout_val = < / span > < span class = cFB > counts< / span > < span class = cF0 > .jiffies;
< a name = "l278" > < / a > tie = < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l279" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l280" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l281" > < / a > {
< a name = "l282" > < / a > last_st = st;
< a name = "l283" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (*st == < / span > < span class = cF6 > '('< / span > < span class = cF0 > )
< a name = "l284" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l285" > < / a > tie=< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l286" > < / a > st++;
< a name = "l287" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l288" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l289" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l290" > < / a > st = < / span > < span class = cF5 > MusicSetMeter< / span > < span class = cF0 > (st);
< a name = "l291" > < / a > st = < / span > < span class = cF5 > MusicSetOctave< / span > < span class = cF0 > (st);
< a name = "l292" > < / a > st = < / span > < span class = cF5 > MusicSetNoteLen< / span > < span class = cF0 > (st);
< a name = "l293" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l294" > < / a > }
< a name = "l295" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (st != last_st);
2021-07-03 05:07:57 +01:00
< a name = "l296" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l297" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!*st)
< a name = "l298" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l299" > < / a > note = *st++ - < / span > < span class = cF6 > 'A'< / span > < span class = cF0 > ;
< a name = "l300" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (note < < / span > < span class = cFE > 7< / span > < span class = cF0 > )
< a name = "l301" > < / a > {
< a name = "l302" > < / a > note = < / span > < span class = cFB > music< / span > < span class = cF0 > .note_map[note];
< a name = "l303" > < / a > octave = < / span > < span class = cFB > music< / span > < span class = cF0 > .octave;
< a name = "l304" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (*st == < / span > < span class = cF6 > 'b'< / span > < span class = cF0 > )
< a name = "l305" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l306" > < / a > note--;
< a name = "l307" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (note == < / span > < span class = cFE > 2< / span > < span class = cF0 > )
< a name = "l308" > < / a > octave--;
< a name = "l309" > < / a > st++;
< a name = "l310" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l311" > < / a > < / 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 > )
< a name = "l312" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l313" > < / a > note++;
< a name = "l314" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (note == < / span > < span class = cFE > 3< / span > < span class = cF0 > )
< a name = "l315" > < / a > octave++;
< a name = "l316" > < / a > st++;
< a name = "l317" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l318" > < / a > ona = < / span > < span class = cF5 > Note2Ona< / span > < span class = cF0 > (note, octave);
< a name = "l319" > < / a > }
< a name = "l320" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l321" > < / a > ona = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l322" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (words & & < / span > < span class = cF7 > (< / span > < span class = cF0 > word = < / span > < span class = cF5 > ListSub< / span > < span class = cF0 > (i++, words)< / span > < span class = cF7 > )< / span > < span class = cF0 > & & < / span > < span class = cF5 > StrCompare< / span > < span class = cF7 > (< / span > < span class = cF0 > word, < / span > < span class = cF6 > " " < / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l323" > < / a > < / span > < span class = cF6 > " %s" < / span > < span class = cF0 > , word;
2021-07-03 05:07:57 +01:00
< a name = "l324" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l325" > < / 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 = "l326" > < / a > on_jiffies = d * < / span > < span class = cFB > music< / span > < span class = cF0 > .stacatto_factor;
< a name = "l327" > < / a > off_jiffies = d * (< / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > - < / span > < span class = cFB > music< / span > < span class = cF0 > .stacatto_factor);
2021-07-03 05:07:57 +01:00
< a name = "l328" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l329" > < / a > timeout_val += on_jiffies;
< a name = "l330" > < / a > timeout_val2 = timeout_val + off_jiffies;
2021-07-03 05:07:57 +01:00
< a name = "l331" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l332" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cFB > music< / span > < span class = cF0 > .mute)
< a name = "l333" > < / a > < / span > < span class = cF5 > Sound< / span > < span class = cF0 > (ona);
< a name = "l334" > < / a > < / span > < span class = cF5 > SleepUntil< / span > < span class = cF0 > (timeout_val);
< a name = "l335" > < / 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);
2021-07-03 05:07:57 +01:00
< a name = "l336" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l337" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cFB > music< / span > < span class = cF0 > .mute & & !tie)
< a name = "l338" > < / a > < / span > < span class = cF5 > Sound< / span > < span class = cF0 > ;
< a name = "l339" > < / a > < / span > < span class = cF5 > SleepUntil< / span > < span class = cF0 > (timeout_val2);
< a name = "l340" > < / 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);
2021-07-03 05:07:57 +01:00
< a name = "l341" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l342" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .play_note_num++;
< a name = "l343" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l344" > < / a > }
< a name = "l345" > < / a >
< a name = "l346" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > MusicSettingsReset< / span > < span class = cF0 > ()
< a name = "l347" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l348" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .play_note_num = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l349" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .stacatto_factor = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 9< / span > < span class = cF0 > ;
< a name = "l350" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .tempo = < / span > < span class = cFE > 2< / span > < span class = cF0 > .< / span > < span class = cFE > 5< / span > < span class = cF0 > ;
< a name = "l351" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .octave = < / span > < span class = cFE > 4< / span > < span class = cF0 > ;
< a name = "l352" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .note_len = < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l353" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .meter_top = < / span > < span class = cFE > 4< / span > < span class = cF0 > ;
< a name = "l354" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .meter_bottom = < / span > < span class = cFE > 4< / span > < span class = cF0 > ;
< a name = "l355" > < / a > < / span > < span class = cF5 > SoundReset< / span > < span class = cF0 > ;
< a name = "l356" > < / a > < / span > < span class = cF1 > PUSHFD< / span > < span class = cF0 >
< a name = "l357" > < / a > < / span > < span class = cF1 > CLI< / span > < span class = cF0 >
< a name = "l358" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFB > mp_count< / span > < span class = cF0 > > < / span > < span class = cFE > 1< / span > < span class = cF0 > )
< a name = "l359" > < / 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 > ], < / span > < span class = cFE > 0< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l360" > < / a > < / span > < span class = cF1 > PAUSE< / span > < span class = cF0 >
< a name = "l361" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .last_tM = < / span > < span class = cF5 > tM< / span > < span class = cF0 > ;
< a name = "l362" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .last_Beat = < / span > < span class = cFE > 0< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l363" > < / 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 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l364" > < / a > < / span > < span class = cF1 > POPFD< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l365" > < / a > }
< a name = "l366" > < / a >
< a name = "l367" > < / a > < / span > < span class = cF5 > MusicSettingsReset< / span > < span class = cF0 > ;
< a name = "l368" > < / a >
< a name = "l369" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > CurSongTask< / span > < span class = cF0 > ()
< a name = "l370" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l371" > < / a > < / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> task_end_cb = & < / span > < span class = cF5 > SoundTaskEndCB< / span > < span class = cF0 > ;
< a name = "l372" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF3 > TRUE< / span > < span class = cF0 > )
< a name = "l373" > < / a > < / span > < span class = cF5 > Play< / span > < span class = cF0 > (< / span > < span class = cFB > music< / span > < span class = cF0 > .cur_song);
2021-07-03 05:07:57 +01:00
< a name = "l374" > < / a > }
< a name = "l375" > < / a >
< a name = "l376" > < / a > #< / span > < span class = cF1 > help_index< / span > < span class = cF0 > < / span > < span class = cF6 > " Sound" < / span > < span class = cF0 >
< a name = "l377" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l378" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > SE_NOISE< / span > < span class = cF0 > < / span > < span class = cFE > 0< / span > < span class = cF0 >
< a name = "l379" > < / a > #< / span > < span class = cF1 > define< / span > < span class = cF0 > < / span > < span class = cF3 > SE_SWEEP< / span > < span class = cF0 > < / span > < span class = cFE > 1< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l380" > < / a >
< a name = "l381" > < / a > < / span > < span class = cF1 > class< / span > < span class = cF0 > < / span > < span class = cF9 > CSoundEffectFrame< / span > < span class = cF0 >
< a name = "l382" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l383" > < / a > < / span > < span class = cF9 > I32< / span > < span class = cF0 > type;
< a name = "l384" > < / a > < / span > < span class = cF1 > I8< / span > < span class = cF0 > ona1, ona2;
< a name = "l385" > < / a > < / span > < span class = cF1 > F64< / span > < span class = cF0 > duration;
2021-07-03 05:07:57 +01:00
< a name = "l386" > < / a > };
< a name = "l387" > < / a >
< a name = "l388" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > SoundEffectEndTaskCB< / span > < span class = cF0 > ()
< a name = "l389" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l390" > < / 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 = "l391" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .mute--;
< a name = "l392" > < / a > < / span > < span class = cF5 > SoundTaskEndCB< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l393" > < / a > }
< a name = "l394" > < / a >
< a name = "l395" > < / 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 = "l396" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l397" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i, ona;
< a name = "l398" > < / 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;
2021-07-03 05:07:57 +01:00
< a name = "l399" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l400" > < / a > < / span > < span class = cF5 > FramePtrAdd< / span > < span class = cF0 > (< / span > < span class = cF6 > " CSoundEffectFrame" < / span > < span class = cF0 > , ns);
< a name = "l401" > < / a > < / span > < span class = cF5 > Fs< / span > < span class = cF0 > -> task_end_cb = & < / span > < span class = cF5 > SoundEffectEndTaskCB< / span > < span class = cF0 > ;
< a name = "l402" > < / a > < / span > < span class = cF1 > switch< / span > < span class = cF0 > (ns-> type)
< a name = "l403" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l404" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > SE_NOISE< / span > < span class = cF0 > :
< a name = "l405" > < / a > i = < / span > < span class = cF5 > MaxI64< / span > < span class = cF0 > (ns-> ona2 - ns-> ona1, < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l406" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > tS< / span > < span class = cF0 > < timeout)
< a name = "l407" > < / a > {
< a name = "l408" > < / a > ona = < / span > < span class = cF5 > RandU16< / span > < span class = cF0 > % i + ns-> ona1;
< a name = "l409" > < / a > < / span > < span class = cF5 > Sound< / span > < span class = cF0 > (ona);
< a name = "l410" > < / a > t = < / span > < span class = cF5 > Clamp< / span > < span class = cF0 > (< / span > < span class = cFE > 3000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > / < / span > < span class = cF5 > Ona2Freq< / span > < span class = cF7 > (< / span > < span class = cF0 > ona< / span > < span class = cF7 > )< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 50< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l411" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t + < / span > < span class = cF5 > tS< / span > < span class = cF0 > > timeout)
< a name = "l412" > < / a > t = timeout - < / span > < span class = cF5 > tS< / span > < span class = cF0 > ;
< a name = "l413" > < / a > < / span > < span class = cF5 > Sleep< / span > < span class = cF0 > (t);
< a name = "l414" > < / a > }
< a name = "l415" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l416" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l417" > < / a > < / span > < span class = cF1 > case< / span > < span class = cF0 > < / span > < span class = cF3 > SE_SWEEP< / span > < span class = cF0 > :
< a name = "l418" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > tS< / span > < span class = cF0 > < timeout)
< a name = "l419" > < / a > {
< a name = "l420" > < / a > t = (< / span > < span class = cF5 > tS< / span > < span class = cF0 > - t0) / ns-> duration;
< a name = "l421" > < / a > ona = (< / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > - t) * ns-> ona1 + t * ns-> ona2;
< a name = "l422" > < / a > < / span > < span class = cF5 > Sound< / span > < span class = cF0 > (ona);
< a name = "l423" > < / a > t = < / span > < span class = cF5 > Clamp< / span > < span class = cF0 > (< / span > < span class = cFE > 3000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > / < / span > < span class = cF5 > Ona2Freq< / span > < span class = cF7 > (< / span > < span class = cF0 > ona< / span > < span class = cF7 > )< / span > < span class = cF0 > , < / span > < span class = cFE > 1< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > , < / span > < span class = cFE > 50< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l424" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (t + < / span > < span class = cF5 > tS< / span > < span class = cF0 > > timeout)
< a name = "l425" > < / a > t = timeout -< / span > < span class = cF5 > tS< / span > < span class = cF0 > ;
< a name = "l426" > < / a > < / span > < span class = cF5 > Sleep< / span > < span class = cF0 > (t);
< a name = "l427" > < / a > }
< a name = "l428" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l429" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l430" > < / a > }
< a name = "l431" > < / a >
< a name = "l432" > < / 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 = "l433" > < / a > {< / span > < span class = cF2 > //Make white noise for given number of mS.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l434" > < / a > < / span > < span class = cF9 > CSoundEffectFrame< / span > < span class = cF0 > *ns;
2021-07-03 05:07:57 +01:00
< a name = "l435" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l436" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (mS > < / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l437" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l438" > < / 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 = "l439" > < / a > ns-> type = < / span > < span class = cF3 > SE_NOISE< / span > < span class = cF0 > ;
< a name = "l440" > < / a > ns-> duration = mS / < / span > < span class = cFE > 1000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l441" > < / a > ns-> ona1 = min_ona;
< a name = "l442" > < / a > ns-> ona2 = max_ona;
< a name = "l443" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .mute++;
< a name = "l444" > < / 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 = "l445" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l446" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l447" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l448" > < / a > }
< a name = "l449" > < / a >
< a name = "l450" > < / 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 = "l451" > < / a > {< / span > < span class = cF2 > //Sweep through freq range in given number of mS.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l452" > < / a > < / span > < span class = cF9 > CSoundEffectFrame< / span > < span class = cF0 > *ns;
2021-07-03 05:07:57 +01:00
< a name = "l453" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l454" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (mS > < / span > < span class = cFE > 0< / span > < span class = cF0 > )
< a name = "l455" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l456" > < / 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 = "l457" > < / a > ns-> type = < / span > < span class = cF3 > SE_SWEEP< / span > < span class = cF0 > ;
< a name = "l458" > < / a > ns-> duration = mS / < / span > < span class = cFE > 1000< / span > < span class = cF0 > .< / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l459" > < / a > ns-> ona1 = ona1;
< a name = "l460" > < / a > ns-> ona2 = ona2;
< a name = "l461" > < / a > < / span > < span class = cFB > music< / span > < span class = cF0 > .mute++;
< a name = "l462" > < / 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 = "l463" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l464" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l465" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l466" > < / a > }
< / span > < / pre > < / body >
< / html >