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

📄 player_8c-source.html

📁 MP3播放器源代码, VS1003B
💻 HTML
📖 第 1 页 / 共 4 页
字号:
00728   <span class="comment">//uiMode = UI_SPEC; /* User interface: show title SPECANA FOR VS1003*/</span>00729 00730   <a class="code" href="lcd_8h.html#a1">LcdLocateHome</a>();00731   <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"Opening "</span>);00732 00733   ConsoleWrite (<span class="stringliteral">"Building file fragment table..."</span>);00734   nFragments = <a class="code" href="filesys_8c.html#a19">BuildFragmentTable</a>(); <span class="comment">/* Too slow, rewrite! */</span>00735   ConsoleWrite(<span class="stringliteral">"\rFragments: "</span>);00736   ConsolePutUInt(nFragments);00737 00738   <a class="code" href="lcd_8h.html#a1">LcdLocateHome</a>();00739   <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"Playing "</span>);00740 00741   <span class="keywordflow">for</span> (c=0; c&lt;nFragments; c++){00742     <a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a> = <a class="code" href="filesys_8c.html#a6">fragment</a>[c].<a class="code" href="structfragmentEntry.html#o0">start</a>;00743     ConsoleWrite (<span class="stringliteral">"\rPlayer: Playing from sector "</span>);00744     ConsolePutUInt (<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00745     <span class="keywordflow">if</span> (<a class="code" href="vs10xx_8h.html#a40">PlayDiskSectors</a>(<a class="code" href="filesys_8c.html#a6">fragment</a>[c].length)!=0){00746       <a class="code" href="vs10xx_8h.html#a32">Mp3WriteRegister</a>(<a class="code" href="vs10xx_8h.html#a2">SPI_MODE</a>,0,<a class="code" href="vs10xx_8h.html#a21">SM_OUTOFWAV</a>);00747       <a class="code" href="vs10xx_8c.html#a5">SendZerosToVS10xx</a>();00748       <span class="keywordflow">return</span>; <span class="comment">//return without touching the value of playingState</span>00749     }00750   }00751   <a class="code" href="vs10xx_8c.html#a5">SendZerosToVS10xx</a>();00752 00753   <span class="comment">// After finishing normally default to requesting to play next song        </span>00754   <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00755 00756 }00757 00758 00759 <a name="l00765"></a><a class="code" href="player_8c.html#a14">00765</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a14">main</a>(){00766 00767   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> currentFile;00768 00769   <a class="code" href="board_8c.html#a4">InitBoard</a>();00770 00771   <span class="comment">// Start "User Interface" timer</span>00772   ET0 = 1;00773   EA = 1; 00774   TR0 = 1;00775 00776   <span class="comment">//LcdSplashScreen(); </span>00777   <a class="code" href="display_8h.html#a14">InitDisplay</a> (<a class="code" href="display_8h.html#a0">DS_STATIC</a>,<span class="stringliteral">"        "</span>,<span class="stringliteral">"        "</span>,0);00778   00779   ConsoleWrite (<span class="stringliteral">"\rVLSIPlayer\rStarting up.\r\r"</span>);00780      00781   <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00782   <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a> (<span class="stringliteral">"Filesys "</span>);00783   <a class="code" href="lcd_8h.html#a2">LcdLocateLine2</a>();00784   <a class="code" href="lcd_8h.html#a14">LcdPrintGenericResult</a> (<a class="code" href="filesys_8c.html#a24">InitFileSystem</a>());00785 00786   <a class="code" href="vs10xx_8c.html#a3">Mp3Reset</a>();00787   <a class="code" href="player_8c.html#a9">LoadPatch</a>();00788   <a class="code" href="player_8c.html#a10">StartPatch</a>();00789 00790   <span class="comment">// If left button is pressed during boot, enter recording.</span>00791   <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00792     <span class="keywordflow">while</span>(<a class="code" href="board_8h.html#a17">KEY_LEFT</a>)00793       ;00794     <a class="code" href="record_8c.html#a3">Record</a>();00795   }00796 00797   00798 <span class="preprocessor">#ifdef VS1003</span>00799 <span class="preprocessor"></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">//For VS1003 default to SPECTRUM ANALYZER screen</span>00800 <span class="preprocessor">#else</span>00801 <span class="preprocessor"></span>  <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>;  <span class="comment">//For others, default to TITLE screen</span>00802 <span class="preprocessor">#endif</span>00803 <span class="preprocessor"></span>  00804   <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00805   currentFile = 1;00806 00807   <span class="keywordflow">while</span> (1){00808     ConsoleWrite(<span class="stringliteral">"SPMax: "</span>);ConsolePutHex8(<a class="code" href="player_8c.html#a7">SPMax</a>);00809     ConsoleWrite(<span class="stringliteral">"PlayingState: "</span>);ConsolePutHex8(<a class="code" href="player_8c.html#a3">playingState</a>);00810 00811     <span class="comment">// has someone requested to record?</span>00812     <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>){00813       <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>;00814       <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="record_8c.html#a3">Record</a>(); <span class="comment">//record returns PS_NEXT_SONG or PS_RECORDING</span>00815       <span class="keywordflow">while</span> (<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)00816         ; <span class="comment">//Wait until button is depressed</span>00817       ConsoleWrite(<span class="stringliteral">"\rFinished recording.\r"</span>);      00818       currentFile = 1;00819       <a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;     00820     }        00821 00822     <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a8">OpenFile</a>(currentFile)){00823       currentFile = 1;00824       <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a8">OpenFile</a>(currentFile)){00825         <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00826         <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"No files."</span>);00827         <span class="keywordflow">while</span>(1);00828       }00829     }00830    00831     <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00832     <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"File "</span>);00833     <a class="code" href="lcd_8h.html#a15">LcdPutUInt</a>(currentFile);00834     <a class="code" href="lcd_8h.html#a2">LcdLocateLine2</a>();00835     <span class="keywordflow">for</span> (<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>=0; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>&lt;8; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>++){00836       <a class="code" href="lcd_8h.html#a6">LcdPutChar</a>(<a class="code" href="filesys_8c.html#a11">currentFileName</a>[<a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>]);00837     }00838     00839         00840     <span class="keywordflow">while</span> ((<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)||(<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>)||(<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>)||00841            (<a class="code" href="board_8h.html#a17">KEY_LEFT</a>)||(<a class="code" href="board_8h.html#a16">KEY_RIGHT</a>))00842       ; <span class="comment">/* Wait until no key is pressed */</span>00843 00844     <span class="keywordflow">while</span> (((!<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)&amp;&amp;(!<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>)&amp;&amp;(!<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>))00845            &amp;&amp;(<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>))00846       ; <span class="comment">/* Wait untis some key is pressed or playing state not normal*/</span>00847 00848     00849     <span class="comment">/* See if keystroke requests previous/next song */</span>00850     <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>) currentFile--;00851     <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>) currentFile++;00852     <span class="keywordflow">if</span> (currentFile==0) currentFile = 1;00853 00854     <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a14">KEY_BUTTON</a> || 00855         (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>) || 00856         (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>)){00857       <span class="keywordflow">while</span> (<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)00858         ;00859 00860       <a class="code" href="player_8c.html#a13">PlayCurrentFile</a>();00861       ConsoleWrite (<span class="stringliteral">"Playing state after playing is: "</span>);00862       ConsolePutUInt (<a class="code" href="player_8c.html#a3">playingState</a>);00863       00864       <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>) currentFile--;00865       <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>) currentFile++;00866       <span class="keywordflow">if</span> (currentFile==0) currentFile = 1;00867       <span class="keywordflow">if</span> (<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a13">PS_END_OF_SONG</a>) <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>;      00868       00869       00870       <a class="code" href="vs10xx_8c.html#a2">Mp3SoftReset</a>();00871       <a class="code" href="player_8c.html#a9">LoadPatch</a>();00872       <a class="code" href="player_8c.html#a10">StartPatch</a>();00873 00874 00875       <span class="keywordflow">while</span> ((<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)||(<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>)||(<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>)||00876              (<a class="code" href="board_8h.html#a17">KEY_LEFT</a>)||(<a class="code" href="board_8h.html#a16">KEY_RIGHT</a>))00877         ; <span class="comment">/* Wait until no key is pressed */</span>00878     }00879 00880     00881   }00882    00883 00884 }00885 00886 </div></pre><hr><FONT SIZE="-1">All software copyright 2000-2004 <a href="http://www.vlsi.fi/"> VLSI Solution OY.</a>Redistribution of these software modules are limited to promotional use onlyand only with the VS1011 / VS1002 / VS1003  MP3-Evakit evaluation boards. Free orcommercial use of these software modules in MP3 players is ok if theproduct includes MP3 decoder chip(s) from VLSI. You can request the complete(compilable) package from mp3@vlsi.fi</FONT>

⌨️ 快捷键说明

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