J
jacq
Unregistered / Unconfirmed
GUEST, unregistred user!
在delphi读取MP3文件包含的ID3-Tag头,用下面的方法很简单,作为一个菜鸟也明白。
我的问题是我把例子定义的常量_mp3file改为变量:
var
_mp3file:TStrings;
……
_mp3file:=opendialog1.Files;
……
run的时候说[Error] Unit1.pas(56):
There is no overloaded version of 'Create' that can be called with these arguments
请详细解释给我这只菜鸟好吗?
例子:
type
TID3Tag = packed record // 128 字节
TAGID: array[0..2] of char;
// 3 字节: 必须是TAG
Title: array[0..29] of char;
// 30 字节: 歌曲标题
Artist: array[0..29] of char;
// 30 字节: 歌曲的艺术家
Album: array[0..29] of char;
// 30 字节: 歌曲专辑
Year: array[0..3] of char;
// 4 字节: 出版年
Comment: array[0..29] of char;
// 30 字节: 评论
Genre: byte;
// 1 字节: 种类标识
end;
procedure TForm1.Button1Click(Sender: TObject);
const //我的问题
_mp3file='G:/Mp3/Miscellaneous/ATC - Around The World.mp3';
var
id3tag: Tid3tag;
mp3file: Tfilestream;
begin
mp3file:=Tfilestream.create(_mp3file,fmOpenRead);//run的时候会出错
try
mp3file.position:=mp3file.size-128;
// 跳到id3-tag
mp3file.Read(id3tag,SizeOf(id3tag));
showmessage(' Title: '+id3tag.title+#13+
' Artist: '+id3tag.artist+#13+
' Album: '+id3tag.album+#13+
' Year: '+id3tag.year+#13+
' Comment: '+id3tag.comment+#13+
' Genre-ID: '+inttostr(id3tag.genre)
);
finally
mp3file.free;
end;
end;
我的问题是我把例子定义的常量_mp3file改为变量:
var
_mp3file:TStrings;
……
_mp3file:=opendialog1.Files;
……
run的时候说[Error] Unit1.pas(56):
There is no overloaded version of 'Create' that can be called with these arguments
请详细解释给我这只菜鸟好吗?
例子:
type
TID3Tag = packed record // 128 字节
TAGID: array[0..2] of char;
// 3 字节: 必须是TAG
Title: array[0..29] of char;
// 30 字节: 歌曲标题
Artist: array[0..29] of char;
// 30 字节: 歌曲的艺术家
Album: array[0..29] of char;
// 30 字节: 歌曲专辑
Year: array[0..3] of char;
// 4 字节: 出版年
Comment: array[0..29] of char;
// 30 字节: 评论
Genre: byte;
// 1 字节: 种类标识
end;
procedure TForm1.Button1Click(Sender: TObject);
const //我的问题
_mp3file='G:/Mp3/Miscellaneous/ATC - Around The World.mp3';
var
id3tag: Tid3tag;
mp3file: Tfilestream;
begin
mp3file:=Tfilestream.create(_mp3file,fmOpenRead);//run的时候会出错
try
mp3file.position:=mp3file.size-128;
// 跳到id3-tag
mp3file.Read(id3tag,SizeOf(id3tag));
showmessage(' Title: '+id3tag.title+#13+
' Artist: '+id3tag.artist+#13+
' Album: '+id3tag.album+#13+
' Year: '+id3tag.year+#13+
' Comment: '+id3tag.comment+#13+
' Genre-ID: '+inttostr(id3tag.genre)
);
finally
mp3file.free;
end;
end;