?? source code.mht
字號:
From: <由 Microsoft Internet Explorer 5 保存>
Subject: Homemade USB 2 Harddrive MP3 Player Source Code & Description
Date: Wed, 6 Oct 2004 12:34:11 +0800
MIME-Version: 1.0
Content-Type: multipart/related;
boundary="----=_NextPart_000_001F_01C4ABA0.C8178C40";
type="text/html"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
This is a multi-part message in MIME format.
------=_NextPart_000_001F_01C4ABA0.C8178C40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.frankvh.com/mp3player/software.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Homemade USB 2 Harddrive MP3 Player Source Code & =
Description</TITLE>
<META=20
content=3D"Homemade harddrive MP3 player homebuilt diskdrive MP3 player =
USB interface USB2 USB 2.0 USB Drive audio player stereo high capacity =
do it yourself mp3 player kit software sourcecode hardware schematic =
circuit diagram"=20
name=3Dkeywords><!-- InstanceBegin =
template=3D"/Templates/MP3CSStemplate.dwt" =
codeOutsideHTMLIsLocked=3D"false" --><!-- InstanceBeginEditable =
name=3D"head" --><!-- InstanceEndEditable --><!-- InstanceBeginEditable =
name=3D"doctitle" --><!-- InstanceEndEditable -->
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1"><LINK=20
href=3D"http://www.frankvh.com/mp3player/mp3style.css" type=3Dtext/css=20
rel=3Dstylesheet>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD>
<BODY>
<DIV id=3DBannerLeft><IMG height=3D61 =
src=3D"http://www.frankvh.com/mp3player/mp3.gif"=20
width=3D175 align=3Dmiddle> </DIV>
<DIV id=3DBannerBody>Homebuilt MP3 Player </DIV>
<DIV id=3DBottomBanner>A do-it-yourself high-capacity harddisk-based MP3 =
Player=20
with USB 2.0 </DIV>
<DIV id=3DLeftMenu>
<P><A class=3Dmenu =
href=3D"http://www.frankvh.com/mp3player/index.html">Home</A></P>
<P><A class=3Dmenu=20
href=3D"http://www.frankvh.com/mp3player/hwdetails.htm">Hardware<BR>Descr=
iption</A></P>
<P><A class=3Dmenu=20
href=3D"http://www.frankvh.com/mp3player/schematics.htm">Schematics=20
&<BR>PCB</A></P>
<P><A class=3Dmenu=20
href=3D"http://www.frankvh.com/mp3player/software.htm">Software</A></P>
<P><A class=3Dmenu =
href=3D"http://www.frankvh.com/mp3player/kits.htm">Kits=20
&<BR>Parts</A></P>
<P><A class=3Dmenu=20
href=3D"http://www.frankvh.com/mp3player/driveselection.htm">Drive=20
Selection</A></P>
<P><A class=3Dmenu =
href=3D"http://www.frankvh.com/mp3player/usb2.htm">USB=20
2.0</A></P>
<P><A class=3Dmenu=20
href=3D"http://www.frankvh.com/mp3player/buildnotes.htm">Construction<BR>=
Notes</A></P>
<P><A class=3Dmenu =
href=3D"http://www.frankvh.com/mp3player/createmp3s.htm">Creating=20
MP3s</A></P>
<P><A class=3Dmenu =
href=3D"http://www.frankvh.com/mp3player/news.htm">Latest=20
News</A></P>
<P><A class=3Dmenu=20
href=3D"http://www.frankvh.com/mp3player/contact.htm">Contact</A></P>
<HR color=3D#000000 noShade SIZE=3D1>
<P> </P></DIV>
<DIV id=3DPageBody><!-- InstanceBeginEditable name=3D"EditRegion1" -->
<H2>Software, Source Code</H2>
<P>If you're quickly looking for the latest .hex file to program into =
the AVR,=20
here it is:</P>
<P align=3Dcenter><A =
href=3D"http://www.frankvh.com/mp3player/frankmp3.hex"><IMG=20
height=3D36 src=3D"http://www.frankvh.com/mp3player/floppydisk.gif" =
width=3D34=20
align=3DabsMiddle border=3D0></A></P>
<P>Just click on the icon to download the.hex file. Or rightclick then =
select=20
"Save Target As..." or similar. This file was updated 21 August =
2004.</P>
<P>The full source code is also available. This code is built using the =
GNU=20
tools, specifically the winavr toolset freely downloadable from <A=20
href=3D"http://www.avrfreaks.com/" target=3D_top>avrfreaks.</A> If =
you're working in=20
Windows you'll need the WinAVR compiler installed and working to be able =
to=20
recompile this source. I recommend using the 20040404 version, =
downloadable <A=20
href=3D"http://prdownloads.sourceforge.net/winavr/WinAVR-20040404-bin-ins=
tall.exe?download">here.</A>=20
To recompile the source code, just type "make" (without the quotes).</P>
<P>The file is a .zip file. It contains some text files with useful =
information.=20
There seems to be some interest from other people wishing to do some =
software=20
development for the player themselves. I'd certainly be supportive of =
that. The=20
source is heavily commented. If the need arises I can look at putting =
the code=20
up on a CVS server. For now though it's just a simple zip file. This =
file was=20
updated 21 August 2004.</P>
<P align=3Dcenter><A =
href=3D"http://www.frankvh.com/mp3player/mp3sources.zip"><IMG=20
height=3D36 src=3D"http://www.frankvh.com/mp3player/floppydisk.gif" =
width=3D34=20
border=3D0></A></P>
<P>For older versions of the software, <A=20
href=3D"http://www.frankvh.com/mp3player/oldsoftware.htm">click =
here.</A></P>
<P>If you're looking for a mass-storage class driver for Windows 98, or =
for the=20
serial eeprom file, look at my <A=20
href=3D"http://www.frankvh.com/mp3player/usb2.htm" target=3D_self>USB =
2.0=20
page.</A></P>
<P> </P>
<H2>Software Features</H2>
<P>The MP3 player software has a number of features: random mode, repeat =
mode,=20
subdirectory support, output level control, etc. The operation of the =
player is=20
described in more detail below. A lot of time has been spent on two =
things: </P>
<UL>
<LI>making the existing software stable, and=20
<LI>making the existing software work quickly with large numbers of =
files.=20
</LI></UL>
<P>To this end there are precious few known bugs in the player. I run it =
for=20
hours and hours on end. </P>
<P>Making it run well with lots of songs was a challenge given the =
limited=20
memory on board the player. Two tricks have proven to be a great help. =
One is a=20
FAT look-ahead function, which greatly speeds accesses to the FAT32 File =
Allocation Table. This look-ahead function handles both fragmented and=20
unfragmented files. The second is a fast-find table. This table is built =
each=20
time the files on the disk are changed (not at each powerup; only when =
things=20
change or when the current directory is changed) and is stored in =
eeprom. It=20
works in conjunction with the regular FAT32 directory structure to =
dramatically=20
speed up locating arbitary files (eg the 754th file) in the current=20
directory.</P>
<H4>Random</H4>
<P>Random mode appears random but is not truely random. I initially =
implemented=20
a true random mode, but this meant that sometimes a song would be =
repeated while=20
others wouldn't be played. After a while it annoyed me. The current =
random mode=20
is better described as a "randomized shuffle". Although it never behaves =
the=20
same way twice, it guarantees that all songs will be played before any =
are=20
repeated, yet the song order usually appears completely random. (It does =
use a=20
random seed.) This mode works quite well and I'm very happy with it. =
Random=20
defaults to off.</P>
<H4>Repeat</H4>
<P>This defines what happens when the player is not in random mode and =
it plays=20
the last song in the directory. If repeat is off the player will stop. =
If repeat=20
is on the player will wrap around to the beginning of the directory =
again.=20
Repeat defaults to on.</P>
<H4>Stop</H4>
<P>The "stop" button works as follows. A single press will stop playing =
of the=20
current track, but the track number will be remembered. Pressing "play" =
at this=20
point will result in re-playing of the same track that had just been =
stopped.=20
This is very useful for temporarily stopping playing, then resuming from =
the=20
same song you left off.</P>
<P>Pressing "stop" twice (ie pressing it twice in a row) will result in =
the=20
track number being reset to the beginning. If you press "play" after =
this=20
(provided random mode is off) the first song in the current directory =
will play.=20
This is useful for going back to the beginning of a directory for =
example.</P>
<P> </P>
<H3>Menus</H3>
<P>There is a menu stucture in place. To enter the menus, press the=20
"menu/select" button. This will stop the playing of the current song =
(necessary=20
because the menu items alter hardware settings or access the disk). Use =
the up=20
and down arrows to scroll through the menus, and press the "menu/select" =
button=20
to select a menu item. To exit the menus, select the "exit menus" menu =
item.</P>
<H4>Change Output Level</H4>
<P>This is a menu function which allows you to alter the output (volume) =
level=20
of the player. It's useful because the audio output level of the MP3 =
player, by=20
default, may be too high for the input of some stereo systems. You'll =
know if=20
you have this problem because the audio will sound very distorted, due =
to the=20
stereo clipping. This menu function allows you to decrease the audio =
level, all=20
the way down to zero if desired. The output level value is stored in =
eeprom so=20
it is remembered across power-downs. It may have to be re-entered if the =
player=20
is reprogrammed (software updated), as some programming utilities erase =
the=20
eeprom contents.</P>
<H4>Change Current Directory</H4>
<P>As its name suggests, this menu function allows the use to change the =
current=20
directory (the directory that MP3 files are played from). The directory =
is=20
stored in eeprom so it's remembered across power-downs. If the USB port =
is used=20
the player defaults back to the root directory, because its possible =
that the=20
current directory was deleted or in some way altered during the USB =
changes=20
(file changes, create new dirs, delete dirs, etc can all be done via the =
USB=20
port).</P>
<P>The name of the current directory is displayed towards the top of the =
LCD.=20
Below that the subdirectories can be scrolled through with the Up & =
Down=20
buttons. Every directory contains a "select this directory" item; press =
the=20
Select button to choose the current directory and return to normal =
player=20
operation. Alternatively scroll up and down through the displayed =
subdirectories=20
and press Select to change down (or up) into a new directory. There is =
no limit=20
on the number of directories that can be navigated through.</P>
<H4>Number of Songs In Current Directory</H4>
<P>This menu function displays the name of the current directory and the =
number=20
of MP3 files contained in it.</P>
<H4><A name=3Dremotecontrol></A>Learn IR Remote Control</H4>
<P>This allows you to train the player to use a remote-control for most=20
functions (such as play, stop, next, power, etc). Follow the on-screen=20
instructions. The "learnt" remote-control codes are stored in EEPROM so =
they're=20
remembered across power-downs. Not all remote controls will work, =
although most=20
seem to. I have tested with six remote-controls; here are the =
results:</P>
<TABLE borderColor=3D#009900 cellPadding=3D10 width=3D"70%" border=3D1>
<TBODY>
<TR>
<TD>Hitachi</TD>
<TD>works well</TD></TR>
<TR>
<TD>JVC</TD>
<TD>works well</TD></TR>
<TR>
<TD>Viewsonic</TD>
<TD>works well</TD></TR>
<TR>
<TD>Yamaha</TD>
<TD>works well</TD></TR>
<TR>
<TD>Sharp</TD>
<TD>works sometimes</TD></TR>
<TR>
<TD>GE</TD>
<TD>does not work</TD></TR></TBODY></TABLE>
<P>These are just my results; it's even possible that different remotes =
from the=20
same brand could yield different results. If you're having trouble with =
a=20
certain remote, just try another one. The basic issue is that there are =
a=20
variety of frequencies (both IR carrier and modulation frequencies) used =
by=20
different remotes. Although this player uses a fairly general-purpose =
receiver,=20
it cannot receive absolutely everything, and hence there are always some =
remotes=20
that are received poorly, or not at all. (If you happen to know of a =
better IR=20
receiver to use than the SFH5110-36, please tell me.)</P>
<P> </P>
<H3>Stepping Through the Songs</H3>
<P>Software versions 12 Feb 2004 and later support a variety of ways of =
stepping=20
through the MP3s in the current directory. </P>
<P>The simplest method is of course the "next" and "back" buttons. When =
random=20
mode is off, these typically step forward to the next MP3 on the disk, =
or the=20
previous MP3 on the disk, respectively.</P>
<P>In a somewhat similar fashion, the 4 "diamond" pushbuttons can be =
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -