📄 player_8c-source.html
字号:
00702 nFragments = <a class="code" href="filesys_8c.html#a19">BuildFragmentTable</a>(); <span class="comment">/* Too slow, rewrite! */</span>00703 ConsoleWrite(<span class="stringliteral">"\rFragments: "</span>);00704 ConsolePutUInt(nFragments);00705 00706 <a class="code" href="lcd_8h.html#a1">LcdLocateHome</a>();00707 <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"Playing "</span>);00708 00709 <span class="keywordflow">for</span> (c=0; c<nFragments; c++){00710 <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>;00711 ConsoleWrite (<span class="stringliteral">"\rPlayer: Playing from sector "</span>);00712 ConsolePutUInt (<a class="code" href="buffer_8c.html#a2">sectorAddress</a>.<a class="code" href="unionAddress.html#o0">l</a>);00713 <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){00714 <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>);00715 <a class="code" href="vs10xx_8c.html#a5">SendZerosToVS10xx</a>();00716 <span class="keywordflow">return</span>; <span class="comment">//return without touching the value of playingState</span>00717 }00718 }00719 <a class="code" href="vs10xx_8c.html#a5">SendZerosToVS10xx</a>();00720 00721 <span class="comment">// After finishing normally default to requesting to play next song </span>00722 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00723 00724 }00725 00726 00727 <a name="l00733"></a><a class="code" href="player_8c.html#a14">00733</a> <span class="keywordtype">void</span> <a class="code" href="player_8c.html#a14">main</a>(){00734 00735 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> currentFile;00736 00737 <a class="code" href="board_8c.html#a4">InitBoard</a>();00738 00739 <span class="comment">// Start "User Interface" timer</span>00740 ET0 = 1;00741 EA = 1; 00742 TR0 = 1;00743 00744 <span class="comment">//LcdSplashScreen(); </span>00745 <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);00746 00747 ConsoleWrite (<span class="stringliteral">"\rVLSIPlayer\rStarting up.\r\r"</span>);00748 00749 <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00750 <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a> (<span class="stringliteral">"Filesys "</span>);00751 <a class="code" href="lcd_8h.html#a2">LcdLocateLine2</a>();00752 <a class="code" href="lcd_8h.html#a14">LcdPrintGenericResult</a> (<a class="code" href="filesys_8c.html#a24">InitFileSystem</a>());00753 00754 <a class="code" href="vs10xx_8c.html#a3">Mp3Reset</a>();00755 <a class="code" href="player_8c.html#a9">LoadPatch</a>();00756 <a class="code" href="player_8c.html#a10">StartPatch</a>();00757 00758 <span class="comment">// If left button is pressed during boot, enter recording.</span>00759 <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>){00760 <span class="keywordflow">while</span>(<a class="code" href="board_8h.html#a17">KEY_LEFT</a>)00761 ;00762 <a class="code" href="record_8c.html#a3">Record</a>();00763 }00764 00765 00766 <span class="preprocessor">#ifdef VS1003</span>00767 <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>00768 <span class="preprocessor">#else</span>00769 <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>00770 <span class="preprocessor">#endif</span>00771 <span class="preprocessor"></span> 00772 <a class="code" href="player_8c.html#a3">playingState</a> = <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>;00773 currentFile = 1;00774 00775 <span class="keywordflow">while</span> (1){00776 ConsoleWrite(<span class="stringliteral">"SPMax: "</span>);ConsolePutHex8(<a class="code" href="player_8c.html#a7">SPMax</a>);00777 ConsoleWrite(<span class="stringliteral">"PlayingState: "</span>);ConsolePutHex8(<a class="code" href="player_8c.html#a3">playingState</a>);00778 00779 <span class="comment">// has someone requested to record?</span>00780 <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>){00781 <a class="code" href="player_8c.html#a6">uiMode</a> = <a class="code" href="ui_8h.html#a24a2">UI_TITLE</a>;00782 <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>00783 <span class="keywordflow">while</span> (<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)00784 ; <span class="comment">//Wait until button is depressed</span>00785 ConsoleWrite(<span class="stringliteral">"\rFinished recording.\r"</span>); 00786 currentFile = 1;00787 <a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>; 00788 } 00789 00790 <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a8">OpenFile</a>(currentFile)){00791 currentFile = 1;00792 <span class="keywordflow">if</span> (<a class="code" href="filesys_8h.html#a8">OpenFile</a>(currentFile)){00793 <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00794 <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"No files."</span>);00795 <span class="keywordflow">while</span>(1);00796 }00797 }00798 00799 <a class="code" href="lcd_8c.html#a4">LcdReset</a>();00800 <a class="code" href="lcd_8h.html#a10">LcdPutConstantString</a>(<span class="stringliteral">"File "</span>);00801 <a class="code" href="lcd_8h.html#a15">LcdPutUInt</a>(currentFile);00802 <a class="code" href="lcd_8h.html#a2">LcdLocateLine2</a>();00803 <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><8; <a class="code" href="board_8c.html#a0">temp</a>.<a class="code" href="unionTemp.html#o0">c</a>++){00804 <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>]);00805 }00806 00807 00808 <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>)||00809 (<a class="code" href="board_8h.html#a17">KEY_LEFT</a>)||(<a class="code" href="board_8h.html#a16">KEY_RIGHT</a>))00810 ; <span class="comment">/* Wait until no key is pressed */</span>00811 00812 <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>))00813 &&(<a class="code" href="player_8c.html#a3">playingState</a> == <a class="code" href="ui_8h.html#a25a12">PS_NORMAL</a>))00814 ; <span class="comment">/* Wait untis some key is pressed or playing state not normal*/</span>00815 00816 00817 <span class="comment">/* See if keystroke requests previous/next song */</span>00818 <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a18">KEY_FARLEFT</a>) currentFile--;00819 <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a15">KEY_FARRIGHT</a>) currentFile++;00820 <span class="keywordflow">if</span> (currentFile==0) currentFile = 1;00821 00822 <span class="keywordflow">if</span> (<a class="code" href="board_8h.html#a14">KEY_BUTTON</a> || 00823 (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a14">PS_NEXT_SONG</a>) || 00824 (<a class="code" href="player_8c.html#a3">playingState</a>==<a class="code" href="ui_8h.html#a25a15">PS_PREVIOUS_SONG</a>)){00825 <span class="keywordflow">while</span> (<a class="code" href="board_8h.html#a14">KEY_BUTTON</a>)00826 ;00827 00828 <a class="code" href="player_8c.html#a13">PlayCurrentFile</a>();00829 ConsoleWrite (<span class="stringliteral">"Playing state after playing is: "</span>);00830 ConsolePutUInt (<a class="code" href="player_8c.html#a3">playingState</a>);00831 00832 <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--;00833 <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++;00834 <span class="keywordflow">if</span> (currentFile==0) currentFile = 1;00835 <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>; 00836 00837 00838 <a class="code" href="vs10xx_8c.html#a2">Mp3SoftReset</a>();00839 <a class="code" href="player_8c.html#a9">LoadPatch</a>();00840 <a class="code" href="player_8c.html#a10">StartPatch</a>();00841 00842 00843 <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>)||00844 (<a class="code" href="board_8h.html#a17">KEY_LEFT</a>)||(<a class="code" href="board_8h.html#a16">KEY_RIGHT</a>))00845 ; <span class="comment">/* Wait until no key is pressed */</span>00846 }00847 00848 00849 }00850 00851 00852 }00853 00854 </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 + -