RE: TI-H: empeg player
[Prev][Next][Index][Thread]
RE: TI-H: empeg player
Code segment I used to take id3 tags and use them:
// Read an ID3 tag from a file into a songinfo struct: if there's no ID3,
// make something up with the filename. The songinfo struct just has
// song, artist and year fields, along with other bits.
static int id3_read(char *tune,songinfo *s)
{
FILE *f; char buffer[256];
/* Make pathname */
sprintf(buffer,"%s%s",base_path,tune);
/* Try to open the .mp3 */
if ((f=fopen(buffer,"rb"))==NULL) return(1);
/* Go to 128 bytes from the end */
fseek(f,-128L,SEEK_END);
/* Read the buffer */
fread(buffer,1,128,f);
fclose(f);
/* Look for 'TAG' indicating ID3 tag */
if (strncmp(buffer,"TAG",3)==0)
{
char *b=buffer+3,*c=b+29;
/* Found tag, read out title & artist */
while(c>b && *c==' ') c--;
*++c=0;
/* Save title */
strcpy(s->song,b);
b=buffer+33; c=b+29;
while(c>b && *c==' ') c--;
*++c=0;
/* Save artist */
strcpy(s->artist,b);
/* Save year */
if ((s->year=atoi(buffer+93))==0) s->year=9999;
}
else
{
char *b;
/* Take first part of path as band, second as tune */
strcpy(buffer,tune);
/* Convert all _'s to spaces */
b=buffer;
while(*b) if (*b=='_') *b++=' '; else b++;
if ((b=strchr(buffer,'/'))==NULL)
{
/* No path separator, just use filename as song */
strcpy(s->song,buffer);
s->artist[0]=0;
}
else
{
/* Separate them */
*b++=0;
strcpy(s->song,b);
strcpy(s->artist,buffer);
}
}
return(0);
}
>Well, I've already built a car mp3 player.. sort of a cut & paste thing,
>really... I took a CD-ROM drive that I had sitting around, found out it can
>read RW CDs, built a small LCD screen for it, and popped that in the car...
>:) Takes up about the size of a motherboard and a CD-ROM drive. I chose
>using bootable CDs, since you can just omit the HD completely, and cut down
>on size & cost dramatically. Plus, since you don't need to worry about bumps
>with CDs (bang a hard drive head when you go over a nice foot deep pot hole.
>Oops! :), and they're rewriteable, so I don't need to use a new CD for every
>song I wanna update. I made a small controller that is with the screen, so I
>can do the necessary next, prev, play, stop, pause, etc... and all this runs
>under win95(unfortunately. I couldn't find a player that would let me get
>ID3 tag info, and the current playing time under linux... I probably
>could've made my own mp3 decoder, but, I'm lazy.) I made a nice 8 MB RAM
>drive for swap files, and with the 80 MB of el cheapo ram that's in there,
>(2*32, + 2*8), it has enough for a LARGE buffer with the player. I've been
>using it for about 3 months now, haven't had a problem with it... I just
>take out the CD when I want to update it, and throw it back in when I wanna
>play. I figure that I probably spent about $250 total (70 for the
>motherboard, 40 for the CD, 80 for the ram(only 72 pin fast page... It's
>only a Pentium 133 in there.) and other miscellaneous things lying around my
>house (the extra 50 for the screen, controller, power supply, wires, etc).
>But, so far, I have no complaints... but GPS would be nice.. :)
>
>-jeff Dezur
>jeffd@wwnet.net
>
>
>-----Original Message-----
>From: owner-ti-hardware@lists.ticalc.org
>[mailto:owner-ti-hardware@lists.ticalc.org] On Behalf Of David Knaack
>Sent: Thursday, April 01, 1999 10:29 PM
>To: ti-hardware@lists.ticalc.org
>Subject: Re: TI-H: empeg player
>
>
>From: Dan <danti@applecyber.dyndns.com>
>>Too bad no one is making them though... I mean... all those companies need
>>to do is throw in a 6gig 2.5" drive and an LCD screen and they are set.
>
>Yep, all I ask is a ~2 GB shock mounted drive that can be attached to a
>computer
>somehow (preferably by pulling the entire deck and connecting it to the
>drive controller
>in the computer), and some way to store play lists so I can select amoung
>them, just
>as if I had a CD changer. Heck, you could make one of those to go int he
>place of
>traditional CD changers, just give it the same kind of interface to the head
>unit, but
>give it a big HDD instead of CD's. Then you dont' even have to worry about
>interface,
>the user can plug the box into the computer to put songs on and arrange
>playlists.
>
>Forget all this fancy stuff, I just want a simple (ie affordable) device to
>put in the car,
>but it has to have butt-loads of storeage, cuz I like my MP3's at 320Kbps.
>
>DK
References: