Registriert seit: 15. Nov 2004
2.647 Beiträge
|
Re: Sehr großes Problem mit den verschiedenen Audiotags
21. Aug 2006, 11:30
Ok, hier ist der hoffentlich korrekte Code:
Delphi-Quellcode:
TAudioFile = class
private
//Mp3
FID: String;
FTitel: String;
FArtist: String;
FAlbum: String;
FYear: String;
FComment: String;
FGenre: Byte;
FFilename: String;
FEndung: String;
public
constructor Create (AMusicFilename : string) ;
property ID : string read FID write FID;
property Titel : string read FTitel write FTitel;
property Artist : string read FArtist write FArtist;
property Album : string read FAlbum write FAlbum;
property Year : string read FYear write FYear;
property Comment : string read FComment write FComment;
property Genre : byte read FGenre write FGenre;
property Filename : string read FFilename write FFilename;
property Endung : string read FEndung write FEndung;
procedure Read; virtual; abstract;
procedure Write; virtual; abstract;
end;
TMP3File = class(TAudioFile)
public
procedure Read;
procedure Write;
end;
...
constructor TAudioFile.Create (AMusicFilename: String);
begin
FFilename := AMusicFilename;
end;
procedure TfrmMain.ReadAll;
var i : Integer;
begin
for i := 0 to AllSongs.count-1 do
(AllSongs[i] as TAudioFile).Read;
end;
procedure TMP3File.Read;
begin
with TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone) do
try
Position := Size - 128;
Read(FID, 3);
Read(FTitel, 30);
Read(FArtist, 30);
Read(FAlbum, 30);
Read(FYear, 4);
Read(FComment, 30);
Read(FGenre, 1);
finally
Free;
end;
end;
|
|
Zitat
|