📄 player_8c.html
字号:
<td class="md" nowrap valign="top"> void AvailableProcessorTime </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>This is called when there is free processor time, implement externally. <p>The basic task of this function is to implement the player user interface. <p>Local variables:<p><ul><li><b>volume</b>: Current volume setting</li></ul><p><ul><li><b>bass</b>: Current bass enhancer setting</li></ul><p><ul><li><b>treble</b>: Current treble enhancer setting</li></ul><p><ul><li><b>reclevel</b>: Current recording level setting</li></ul><p><ul><li><b>uiReturnDelay</b>: Counts down to returning to UI mode 0 (title screen)</li></ul><p>Bass/Treble setting calculation<p>There are 2 or 4 adjustments possible:<ul><li>Bass Frequency (1011B/E, 1002, 10x3) : 2..15 -> 20..1500 Hz</li><li>Bass boost (1011B/E, 1002, 10x3) : 0..15 -> 0ff..+15dB)</li><li>Treble Frequency (1011E, 10x3) : 0..15 -> 0..15kHz</li><li>Treble level (1011E, 10x3) : -8..+7 -> -12..+10.5dB</li></ul><p>In this software, all are adjusted based from a single setting (0..128) for bass and another for treble. You may wish to allow user to control frequency and level separately or set fixed frequencies for a known speaker type. This algorithm increases the frequency range of adjustment with the increasing level. <p>Definition at line <a class="el" href="player_8c-source.html#l00332">332</a> of file <a class="el" href="player_8c-source.html">player.c</a>.<p>References <a class="el" href="display_8c-source.html#l00014">displayStyle</a>, <a class="el" href="display_8c-source.html#l00011">displayTitle</a>, <a class="el" href="display_8c-source.html#l00015">displayValue</a>, <a class="el" href="display_8h-source.html#l00012">DS_NO_YES</a>, <a class="el" href="display_8h-source.html#l00011">DS_PERCENTAGE</a>, <a class="el" href="display_8h-source.html#l00014">DS_RAWTEXT</a>, <a class="el" href="display_8h-source.html#l00009">DS_TEXT</a>, <a class="el" href="board_8h-source.html#l00095">KEY_BUTTON</a>, <a class="el" href="board_8h-source.html#l00110">KEY_FARLEFT</a>, <a class="el" href="board_8h-source.html#l00098">KEY_FARRIGHT</a>, <a class="el" href="lcdfonts_8c-source.html#l00008">lcdFont_barchars</a>, <a class="el" href="lcdfonts_8c-source.html#l00025">lcdFont_vertical_barchars</a>, <a class="el" href="lcd_8c-source.html#l00056">LcdReset()</a>, <a class="el" href="lcd_8c-source.html#l00043">LcdSelectFont()</a>, <a class="el" href="vs10xx_8c-source.html#l00017">Mp3ReadRegister()</a>, <a class="el" href="vs10xx_8h-source.html#l00078">Mp3SetVolume</a>, <a class="el" href="vs10xx_8h-source.html#l00068">Mp3WriteRegister</a>, <a class="el" href="player_8c-source.html#l00226">playingState</a>, <a class="el" href="ui_8h.html#a25a16">PS_CUE</a>, <a class="el" href="ui_8h.html#a25a13">PS_END_OF_SONG</a>, <a class="el" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>, <a class="el" href="ui_8h.html#a25a12">PS_NORMAL</a>, <a class="el" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>, <a class="el" href="ui_8h.html#a25a23">PS_RECORDING</a>, <a class="el" href="ui_8h.html#a25a19">PS_REWIND</a>, <a class="el" href="player_8c-source.html#l00290">ScreenSetPlayTime()</a>, <a class="el" href="vs10xx_8h-source.html#l00032">SPI_AICTRL1</a>, <a class="el" href="vs10xx_8h-source.html#l00021">SPI_BASS</a>, <a class="el" href="board_8h-source.html#l00235">SPIPutChar</a>, <a class="el" href="board_8h-source.html#l00232">SPIWait</a>, <a class="el" href="ui_8h.html#a24a5">UI_BASS</a>, <a class="el" href="ui_8h.html#a24a7">UI_CUE</a>, <a class="el" href="ui_8h.html#a24a11">UI_END_OF_MODES</a>, <a class="el" href="ui_8h.html#a24a9">UI_INFO</a>, <a class="el" href="ui_8h.html#a24a8">UI_RECLEVEL</a>, <a class="el" href="player_8c-source.html#l00223">UI_RETURN_DELAY</a>, <a class="el" href="ui_8h.html#a24a3">UI_SPEC</a>, <a class="el" href="ui_8h.html#a24a10">UI_STOP</a>, <a class="el" href="ui_8h.html#a24a2">UI_TITLE</a>, <a class="el" href="ui_8h.html#a24a6">UI_TREBLE</a>, <a class="el" href="ui_8h.html#a24a4">UI_VOLUME</a>, <a class="el" href="player_8c-source.html#l00236">uiMode</a>, <a class="el" href="display_8c-source.html#l00058">UpdateDisplay()</a>, and <a class="el" href="player_8c-source.html#l00233">userInterfaceDelayElapsed</a>.<p>Referenced by <a class="el" href="aviplay_8c-source.html#l00015">GetAVIBlock()</a>, <a class="el" href="vs10xx_8c-source.html#l00202">PlayDiskSectors()</a>, and <a class="el" href="record_8c-source.html#l00101">Record()</a>.<p><pre class="fragment"><div>00332 {00333 00337 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> volume = 20;00338 00340 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> bass = 0;00341 00343 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> treble = 64; <span class="comment">//middle setting = 0</span>00344 00346 <span class="keyword">static</span> xdata <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> reclevel = 50;00347 00348 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i; <span class="comment">//temp variable</span>00349 00350 <span class="keyword">static</span> bit bassUpdateNeeded;00351 00355 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> uiReturnDelay=0;00356 00357 00358 <span class="preprocessor">#if 0</span>00359 <span class="preprocessor"></span> <span class="comment">// Simple serial control demo: receiving 'N' advances to next song</span>00360 <span class="comment">// and 'P' to previous song</span>00361 00362 <span class="keywordflow">if</span> (RI) { <span class="comment">//Serial Data Received</span>00363 RI = 0; <span class="comment">//Clear received flag!!!</span>00364 00365 i = SBUF; <span class="comment">// read received character from uart buffer to temp i</span>00366 00367 <span class="keywordflow">if</span> (i==<span class="charliteral">'N'</span>){00368 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00369 }00370 <span class="keywordflow">if</span> (i==<span class="charliteral">'P'</span>){00371 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>;00372 }00373 }00374 <span class="preprocessor">#endif</span>00375 <span class="preprocessor"></span>00376 00377 00378 00379 <span class="keywordflow">if</span> (!<a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a>){00380 <span class="keywordflow">return</span>; <span class="comment">/* Not yet time to do user interface stuff */</span>00381 }00382 00383 <a class="code" href="player_8c.html#a5">userInterfaceDelayElapsed</a> = 0;00384 00385 00386 <span class="comment">// User Interface Modes</span>00387 <span class="comment">// Return to UI_TITLE after long period of button inactivity</span>00388 00389 <span class="keywordflow">if</span> (uiReturnDelay == 0){00390 <span class="keywordflow">if</span> ((<a class="code" href="player_8c.html#a6">uiMode</a> != <a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>)&&(<a class="code" href="player_8c.html#a6">uiMode</a> != <a class="code" href="ui_8h.html#a24a7">UI_CUE</a>))00391 <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>;00392 <span class="keywordflow">else</span>{00393 }00394 }<span class="keywordflow">else</span>{00395 uiReturnDelay--;00396 }00397 00398 00399 00400 <span class="preprocessor">#ifndef VS1003</span>00401 <span class="preprocessor"></span> <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a3">UI_SPEC</a>) <span class="comment">//Only VS1003 has spectrum analyzer</span>00402 <a class="code" href="player_8c.html#a6">uiMode</a>++;00403 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a8">UI_RECLEVEL</a>) <span class="comment">//Only record in VS1003 chips</span>00404 <a class="code" href="player_8c.html#a6">uiMode</a>++;00405 <span class="preprocessor">#endif</span>00406 <span class="preprocessor"></span>00407 00408 00409 00410 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a9">UI_INFO</a>)00411 <a class="code" href="player_8c.html#a6">uiMode</a>++; <span class="comment">//Nothing interesting currently in screen UI_INFO.</span>00412 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a10">UI_STOP</a>)00413 <a class="code" href="player_8c.html#a6">uiMode</a>++; <span class="comment">//Nothing interesting currently in screen UI_STOP.</span>00414 00415 <span class="comment">/* Screen updates */</span>00416 <span class="keywordflow">switch</span>(<a class="code" href="player_8c.html#a6">uiMode</a>){00417 00418 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>: <span class="comment">//Playing time, song title</span>00419 00420 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a1">DS_TEXT</a>;00421 <a class="code" href="player_8c.html#a11">ScreenSetPlayTime</a>();00422 00423 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>){ 00424 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00425 } 00426 00427 <span class="keywordflow">break</span>;00428 00429 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a10">UI_STOP</a>: <span class="comment">//Ask if the user wants to stop</span>00430 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a4">DS_NO_YES</a>;00431 strcpy (displayTitle, <span class="stringliteral">"Stop? "</span>);00432 <span class="keywordflow">break</span>;00433 00434 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a7">UI_CUE</a>: <span class="comment">//Ask if the user wants to fast forward or rewind</span>00435 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a6">DS_RAWTEXT</a>;00436 strcpy (displayTitle, <span class="stringliteral">"REW/CUE <- ->"</span>);00437 00438 <span class="comment">//i = Mp3ReadRegister(SPI_HDAT1);</span>00439 <span class="comment">//displayTitle[5] = lcd_hexchars[i>>12];</span>00440 <span class="comment">//displayTitle[6] = lcd_hexchars[(i>>8)&0x0f];</span>00441 <span class="comment">//displayTitle[7] = lcd_hexchars[(i>>4)&0x0f];</span>00442 <span class="comment">//displayTitle[8] = lcd_hexchars[i&0x0f];</span>00443 00444 <span class="keywordflow">break</span>;00445 00446 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a4">UI_VOLUME</a>: <span class="comment">//Show volume bar</span>00447 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00448 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00449 strcpy(displayTitle,<span class="stringliteral">"Volume: "</span>);00450 <a class="code" href="display_8c.html#a5">displayValue</a> = (100-(volume>>1));00451 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a5">displayValue</a><0) <a class="code" href="display_8c.html#a5">displayValue</a> = 0;00452 <span class="keywordflow">break</span>;00453 00454 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a5">UI_BASS</a>: <span class="comment">//Show bass bar</span>00455 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00456 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00457 strcpy(displayTitle,<span class="stringliteral">"Bass: "</span>);00458 <a class="code" href="display_8c.html#a5">displayValue</a> = (bass/5)*4;00459 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a5">displayValue</a><1) <a class="code" href="display_8c.html#a5">displayValue</a> = 1;00460 <span class="keywordflow">break</span>;00461 00462 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a6">UI_TREBLE</a>: <span class="comment">//Show treble bar</span>00463 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00464 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00465 strcpy(displayTitle,<span class="stringliteral">"Treble: "</span>);00466 <a class="code" href="display_8c.html#a5">displayValue</a> = (treble/5)*4;00467 <span class="keywordflow">if</span> (<a class="code" href="display_8c.html#a5">displayValue</a><1) <a class="code" href="display_8c.html#a5">displayValue</a> = 1;00468 <span class="keywordflow">break</span>;00469 00470 <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a8">UI_RECLEVEL</a>: <span class="comment">//Show recording level</span>00471 00472 <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>){00473 <a class="code" href="lcd_8h.html#a5">LcdSelectFont</a>(lcdFont_barchars);00474 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a3">DS_PERCENTAGE</a>;00475 strcpy(displayTitle,<span class="stringliteral">"RecLevel"</span>);00476 <a class="code" href="display_8c.html#a5">displayValue</a> = (reclevel);00477 <span class="keywordflow">if</span> (reclevel==0){00478 strcpy(displayTitle,<span class="stringliteral">"RecLevel <Auto> "</span>);00479 <a class="code" href="display_8c.html#a4">displayStyle</a> = <a class="code" href="display_8h.html#a6">DS_RAWTEXT</a>; <span class="comment">//Reveal the "auto" text</span>00480 }00481 }<span class="keywordflow">else</span>{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -