⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 player_8c-source.html

📁 MP3 Player Source Code
💻 HTML
📖 第 1 页 / 共 4 页
字号:
00524       <span class="keywordflow">if</span> (volume++ == 254) volume = 254; <span class="comment">//Change + limit to 254 (minimum vol)</span>00525       <a class="code" href="vs10xx_8h.html#a33">Mp3SetVolume</a>(volume,volume);00526     }00527     00528     <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00529       uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>;00530       <span class="keywordflow">if</span> (volume-- == 0) volume = 0; <span class="comment">//Change + limit to 0 (maximum volume)</span>00531       <a class="code" href="vs10xx_8h.html#a33">Mp3SetVolume</a>(volume,volume);00532     }00533     <span class="keywordflow">break</span>; <span class="comment">// UI_VOLUME</span>00534 00535   <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a5">UI_BASS</a>:00536   <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a6">UI_TREBLE</a>: <span class="comment">//BASS and TREBLE use the same VS10xx register</span>00537     bassUpdateNeeded = 0;00538     00539     <span class="comment">//First let's see if a key is pressed; does the user want to set level?</span>00540 00541     <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a6">uiMode</a>==<a class="code" href="ui_8h.html#a24a5">UI_BASS</a>){ <span class="comment">//BASS screen is active</span>00542 00543       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00544         bassUpdateNeeded = 1;00545         <span class="keywordflow">if</span> (bass-- == 0) bass = 0; <span class="comment">//Change + limit to 0 (OFF setting)</span>00546       }00547       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00548         bassUpdateNeeded = 1;00549         <span class="keywordflow">if</span> (bass++ == 127) bass = 127; <span class="comment">//Change + limit to 127 (max setting)</span>00550       }00551 00552     }<span class="keywordflow">else</span>{ <span class="comment">//TREBLE screen is active</span>00553       00554       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00555         bassUpdateNeeded = 1; <span class="comment">//SCI_BASS is for both bass and treble</span>00556         <span class="keywordflow">if</span> (treble-- == 0) treble = 0; <span class="comment">//Change + limit to 0 (OFF setting)</span>00557       }00558       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00559         bassUpdateNeeded = 1; <span class="comment">//SCI_BASS is for both bass and treble</span>00560         <span class="keywordflow">if</span> (treble++ == 127) treble = 127; <span class="comment">//Change + limit to 127 (max)</span>00561       }00562       00563     }00564 00565 00566     <span class="keywordflow">if</span> (bassUpdateNeeded){00567       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> newBassRegister;00568 00569       <span class="comment">//User has pushed button to alter bass/treble register</span>00570       <span class="comment">//calculate new value</span>00571 00587       <span class="comment">//Let's start from bass frequency setting.</span>00588       <span class="comment">//min(0) should give 2 (20Hz), max(127) should give 15 (150Hz)</span>00589       newBassRegister = (bass + 23) / 10; <span class="comment">//into bits 3..0, clear hibits</span>00590       00591       <span class="comment">//Bass boost level.</span>00592       <span class="comment">//min(0) should give 0, max(127) should give 15</span>00593       newBassRegister |= (bass&gt;&gt;3)&lt;&lt;4; <span class="comment">//insert to bits 7..4</span>00594 00595       <span class="comment">//Then the treble frequency</span>00596       <span class="comment">//min(0) should give 15(15kHx), max(127) should give 2(2kHz)</span>00597       newBassRegister |= (((148-treble)&gt;&gt;3)+2)&lt;&lt;8; <span class="comment">//insert into bits 11..8</span>00598 00599       <span class="comment">//Finally the treble value (-8..7)</span>00600       <span class="comment">//min(0) should give -8, max(127) should give 7;</span>00601       newBassRegister |= ((treble&gt;&gt;3)-8)&lt;&lt;12; <span class="comment">//insert into bits 15..12</span>00602       00603       00604       uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>;00605 00606       <span class="keywordflow">if</span> (<a class="code" href="vs10xx_8h.html#a38">Mp3ReadRegister</a>(<a class="code" href="vs10xx_8h.html#a4">SPI_BASS</a>)!=newBassRegister){00607         <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(<a class="code" href="vs10xx_8h.html#a4">SPI_BASS</a>,newBassRegister&gt;&gt;8,newBassRegister&amp;0xff);00608       }00609 00610       <span class="comment">//i = newBassRegister;</span>00611       <span class="comment">//displayTitle[4] = lcd_hexchars[i&gt;&gt;12];</span>00612       <span class="comment">//displayTitle[5] = lcd_hexchars[(i&gt;&gt;8)&amp;0x0f];</span>00613       <span class="comment">//displayTitle[6] = lcd_hexchars[(i&gt;&gt;4)&amp;0x0f];</span>00614       <span class="comment">//displayTitle[7] = lcd_hexchars[i&amp;0x0f];</span>00615     00616 00617     }00618 00619     <span class="keywordflow">break</span>; <span class="comment">// UI_BASS and UI_TREBLE</span>00620 00621 00622   <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a8">UI_RECLEVEL</a>:00623     00624     <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>){00625       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00626         uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>;00627         <span class="keywordflow">if</span> (reclevel++ == 100){00628           reclevel = 100;00629         }00630         <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(<a class="code" href="vs10xx_8h.html#a15">SPI_AICTRL1</a>,00631                          ((<span class="keywordtype">int</span>)reclevel*32)&gt;&gt;8,((<span class="keywordtype">int</span>)reclevel*32)&amp;0xff);00632         <a class="code" href="board_8h.html#a42">SPIPutChar</a>(0);<a class="code" href="board_8h.html#a41">SPIWait</a>();00633       }00634       00635       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00636         uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>;00637         <span class="keywordflow">if</span> (reclevel-- == 0){00638           reclevel = 0;00639         }00640         <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(<a class="code" href="vs10xx_8h.html#a15">SPI_AICTRL1</a>,00641                          ((<span class="keywordtype">int</span>)reclevel*32)&gt;&gt;8,((<span class="keywordtype">int</span>)reclevel*32)&amp;0xff);00642         <a class="code" href="board_8h.html#a42">SPIPutChar</a>(0);<a class="code" href="board_8h.html#a41">SPIWait</a>();00643       }00644     }<span class="keywordflow">else</span>{00645       <span class="comment">//Not in recording</span>00646       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00647         <span class="comment">//Enter recording mode</span>00648         <a class="code" href="player_8c.html#a3">playingState</a>=<a class="code" href="ui_8h.html#a25a23">PS_RECORDING</a>; <span class="comment">//request to record</span>00649       }00650     }00651     <span class="keywordflow">break</span>; <span class="comment">// UI_RECLEVEL</span>00652 00653   <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a10">UI_STOP</a>:00654     00655     <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00656       <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a13">PS_END_OF_SONG</a>; <span class="comment">/* Request to abort playing */</span>00657     }      00658     <span class="keywordflow">break</span>; <span class="comment">// UI_STOP</span>00659     00660   <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a7">UI_CUE</a>:00661     00662     <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>){ <span class="comment">/* Only control when PS_NORMAL */</span>00663       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>){00664         uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>; <span class="comment">/* Don't go back to title just yet */</span>00665         <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a16">PS_CUE</a>; <span class="comment">/* Request */</span>00666       }      00667       <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00668         uiReturnDelay = <a class="code" href="player_8c.html#a2">UI_RETURN_DELAY</a>;00669         <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a19">PS_REWIND</a>; <span class="comment">/* Request */</span>00670       }      00671     }00672 00673     <span class="keywordflow">break</span>; <span class="comment">// UI_SKIP</span>00674 00675   <span class="keywordflow">case</span> <a class="code" href="ui_8h.html#a24a11">UI_END_OF_MODES</a>:00676     <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>;00677     <span class="keywordflow">break</span>; <span class="comment">// UI_END_OF_MODES</span>00678     00679 00680   } <span class="comment">//End Switch</span>00681 00682 00683   <span class="comment">// Draw screen</span>00684   <a class="code" href="display_8c.html#a7">UpdateDisplay</a>();00685 }00686   00687 00688 <a name="l00692"></a><a class="code" href="player_8c.html#a13">00692</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a13">PlayCurrentFile</a>(){00693   xdata <span class="keywordtype">char</span> c, nFragments;00694 00695   <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>; <span class="comment">/* Request to play normally */</span>00696   <span class="comment">//uiMode = UI_SPEC; /* User interface: show title SPECANA FOR VS1003*/</span>00697 00698   <a class="code" href="lcd_8h.html#a1">LcdLocateHome</a>();00699   <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"Opening "</span>);00700 00701   ConsoleWrite (<span class="stringliteral">"Building file fragment table..."</span>);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -