templeos-info/public/Wb/Apps/Psalmody/JukePuppet.HC.HTML

127 lines
12 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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=cF1>U0</span><span class=cF0> SongPuppet(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>I64</span><span class=cF0> passes)
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF9>CDbgInfo</span><span class=cF0> *dbg_info;
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> i,</span><span class=cF1>start</span><span class=cF0>,</span><span class=cF1>end</span><span class=cF0>,rip,last_rip;
<a name="l5"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l6"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;250 &amp;&amp; </span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf=</span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF6>&quot;Song&quot;</span><span class=cF0>,task-&gt;hash_table,</span><span class=cF3>HTT_FUN</span><span class=cF7>)</span><span class=cF0>)
<a name="l8"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l9"></a> </span><span class=cF5>Sleep</span><span class=cF0>(1);
<a name="l10"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf &amp;&amp; </span><span class=cF7>(</span><span class=cF0>dbg_info=tmpf-&gt;dbg_info</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l12"></a> </span><span class=cF1>start</span><span class=cF0>=dbg_info-&gt;body[0];
<a name="l13"></a> </span><span class=cF1>end</span><span class=cF0> =dbg_info-&gt;body[dbg_info-&gt;max_line+1-dbg_info-&gt;min_line];
<a name="l14"></a> last_rip=0;
<a name="l15"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l16"></a> i=0;
<a name="l17"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF0>rip=</span><span class=cF5>TaskCaller</span><span class=cF0>(task,i++)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0>&lt;=rip&lt;</span><span class=cF1>end</span><span class=cF0>) {
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (rip&lt;last_rip &amp;&amp; --passes&lt;=0)
<a name="l20"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l21"></a> last_rip=rip;
<a name="l22"></a> }
<a name="l23"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l24"></a> </span><span class=cF5>Sleep</span><span class=cF0>(1);
<a name="l25"></a> }
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a>}
<a name="l28"></a>
<a name="l29"></a></span><span class=cF1>U0</span><span class=cF0> JukeSongPuppet(</span><span class=cF9>CTask</span><span class=cF0> *juke_task,</span><span class=cF9>I64</span><span class=cF0> passes,</span><span class=cF9>I64</span><span class=cF0> song_num,</span><span class=cF1>U8</span><span class=cF0> *name)
<a name="l30"></a>{
<a name="l31"></a> </span><span class=cF1>Bool</span><span class=cF0> found;
<a name="l32"></a> </span><span class=cF9>CTask</span><span class=cF0> *task;
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l34"></a>
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileExtDot</span><span class=cF7>(</span><span class=cF0>name</span><span class=cF7>)</span><span class=cF0>)
<a name="l36"></a> </span><span class=cF5>FileExtRem</span><span class=cF0>(name);
<a name="l37"></a> </span><span class=cF5>BirthWait</span><span class=cF0>(&amp;juke_task-&gt;popup_task);
<a name="l38"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l39"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(juke_task-&gt;popup_task,</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>,0,</span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>);
<a name="l40"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l41"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;song_num;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(juke_task-&gt;popup_task,</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>,0,</span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>);
<a name="l43"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a>
<a name="l46"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(juke_task-&gt;popup_task,</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>,</span><span class=cF3>CH_SPACE</span><span class=cF0>,0);
<a name="l47"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l48"></a> </span><span class=cF5>Sleep</span><span class=cF0>(500);
<a name="l49"></a>
<a name="l50"></a> found=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l51"></a> task=</span><span class=cF5>Fs</span><span class=cF0>-&gt;next_task;
<a name="l52"></a> </span><span class=cF1>while</span><span class=cF0> (task!=</span><span class=cF5>Fs</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>task-&gt;task_title,name</span><span class=cF7>)</span><span class=cF0>) {
<a name="l54"></a> found=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l55"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l56"></a> }
<a name="l57"></a> task=task-&gt;next_task;
<a name="l58"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l59"></a>
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (found) </span><span class=cF7>{</span><span class=cF2>//Position cursor on song title during song</span><span class=cF0>
<a name="l61"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l62"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(juke_task-&gt;popup_task,</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>,0,</span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>+</span><span class=cF3>SCF_CTRL</span><span class=cF0>);
<a name="l63"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l64"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;song_num;i++) {
<a name="l65"></a> </span><span class=cF5>PostMsg</span><span class=cF0>(juke_task-&gt;popup_task,</span><span class=cF3>MSG_KEY_DOWN_UP</span><span class=cF0>,0,</span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>);
<a name="l66"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(juke_task-&gt;popup_task);
<a name="l67"></a> }
<a name="l68"></a> SongPuppet(task,passes);
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a> </span><span class=cF5>Kill</span><span class=cF0>(task);
<a name="l71"></a>}
<a name="l72"></a>
<a name="l73"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> JukeSongsPuppet(</span><span class=cF1>U8</span><span class=cF0> *dirname=</span><span class=cF6>&quot;~/Psalmody&quot;</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> passes=2,
<a name="l74"></a> </span><span class=cF9>I64</span><span class=cF0> start_song=0,</span><span class=cF9>I64</span><span class=cF0> end_song=</span><span class=cF3>I64_MAX</span><span class=cF0>)
<a name="l75"></a>{</span><span class=cF2>//Help make music video by puppeting JukeBox task.</span><span class=cF0>
<a name="l76"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l77"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde,*tmpde1;
<a name="l78"></a> </span><span class=cF9>CTask</span><span class=cF0> *juke_task=</span><span class=cF5>User</span><span class=cF0>(</span><span class=cF6>&quot;JukeBox(0x%X);\n&quot;</span><span class=cF0>,dirname);
<a name="l79"></a> </span><span class=cF1>F64</span><span class=cF0> t0;
<a name="l80"></a> </span><span class=cF5>Cd</span><span class=cF0>(dirname);
<a name="l81"></a> tmpde1=</span><span class=cF5>FilesFind</span><span class=cF0>(</span><span class=cF6>&quot;*&quot;</span><span class=cF0>,</span><span class=cF3>FUF_RECURSE</span><span class=cF0>|</span><span class=cF3>FUF_JUST_TXT</span><span class=cF0>|</span><span class=cF3>FUF_JUST_FILES</span><span class=cF0>);
<a name="l82"></a> </span><span class=cF1>for</span><span class=cF0> (tmpde=tmpde1,i=0;tmpde &amp;&amp; i&lt;start_song;i++)
<a name="l83"></a> tmpde=tmpde-&gt;next;
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>scrncast</span><span class=cF0>.record)
<a name="l85"></a> t0=</span><span class=cFB>scrncast</span><span class=cF0>.t0_tS;
<a name="l86"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l87"></a> t0=</span><span class=cF5>tS</span><span class=cF0>;
<a name="l88"></a> </span><span class=cF1>for</span><span class=cF0> (i=start_song;tmpde &amp;&amp; i&lt;end_song;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l89"></a> </span><span class=cF6>&quot;%12.6fs %s\n&quot;</span><span class=cF0>,</span><span class=cF5>tS</span><span class=cF0>-t0,tmpde-&gt;full_name;
<a name="l90"></a> JukeSongPuppet(juke_task,passes,i,tmpde-&gt;name);
<a name="l91"></a> tmpde=tmpde-&gt;next;
<a name="l92"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l93"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
<a name="l94"></a> </span><span class=cF5>Kill</span><span class=cF0>(juke_task);
<a name="l95"></a>}
</span></pre></body>
</html>