HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - Tech => Topic started by: winsocker on 2002-01-27 22:55:50

Title: Any good C++ programmers?
Post by: winsocker on 2002-01-27 22:55:50
Hi,

I am trying to read all the ID3 Tag's from a specific loaction (i.e a
CD containg .mp3 files)

I know how to read a single file's mp3 Tag and display the contents but I want to know how to do this for every track on the CD.

i.e. repeat the code below on every track on the CD

Can anyone help me with this?

I presume some iterative loop could be used, but I am unsure how to tackle it.

Thanks for your time,

winsocker

P.S If your really bored you can have a look at my code (BCB)



ID3Tag ID3;

// TRUE if ID3 tag present
BOOL TAG_PRESENT = FALSE;

// char string used to compare “TAG“ string
char tag[4]={0,0,0,0}; //should contain 'TAG' if it exists

// open a file for reading
FILE *InFileTmp=fopen("File.mp3", "rb");

// seek to last 128 bytes
fseek( InFileTmp, -128, SEEK_END);

// read into ID3 struct
fread((void*)&ID3, 1, sizeof(ID3), InFileTmp);

// reading Tag-Info - the first 3 bytes of ID3 should be ‘TAG’
tag[0]=ID3.Tag[0];
tag[1]=ID3.Tag[1];
tag[2]=ID3.Tag[2];

if (!strcmp(tag,"TAG")) TAG_PRESENT = TRUE;
else TAG_PRESENT = FALSE;

if(TAG_PRESENT)
{
txttitle->Text = ID3.Title; // edit boxes used to display retrieved ID3 Information
txtartist->Text = ID3.Artist;
txtalbum->Text = ID3.Album;
txtyear->Text = ID3.Year;
txtcomment->Text = ID3.Comment;

{
char Tag[3];
char Title[30];
char Artist[30];
char Album[30];
char Year[4];
char Comment[30];
BYTE Genre; // an integer which corresponds to a particular genre of music
} ID3Tag;