I tried it as follows:
TID3Rec = packed record
Tag : array[0..2] of Char;
Artist,
CD,
Track : array[0..29] of Char;
end;
procedure TTrack.FillID3TagInformation(MP3File: string; Artist, CD, Track:
TEdit);
var
ID3: TID3Rec;
fMP3: file of Byte;
begin
try
AssignFile(fMP3, MP3File);
Reset(fMP3);
finally
try
Seek(fMP3, FileSize(fMP3) - 128);
BlockRead(fMP3, ID3, SizeOf(ID3));
finally
end;
end;
if ID3.Tag <> 'TAG' then
begin
Artist.Text := 'Wrong or no ID3 tag information';
CD.Text := 'Wrong or no ID3 tag information';
Track.Text := 'Wrong or no ID3 tag information';
end
else
begin
Artist.Text := ID3.Artist;
CD.Text := ID3.CD;
Track.Text := ID3.Track;
end;
end;
Try the following, I have used it before:
procedure TForm1.Button1Click(Sender: TObject);
var f:file of char;
id3:array [0..127] of char;
begin
if opendialog1.execute then
begin
assignfile(f,opendialog1.filename);
reset(f);
seek(f,FileSize(f)-128);
blockread(f,id3,128);
closefile(f);
if copy(id3, 1, 3) = 'TAG' then
begin
label4.caption:=copy(id3, 4, 30);
label2.caption:=copy(id3, 34, 30);
label6.caption:=copy(id3, 64, 30);
label8.caption:=copy(id3, 98, 30);
label10.caption:=copy(id3, 94, 4);
end;
end;
end;
Ignatius Fourie