诸位:
在此送大家一个我自写的显示WAV文件的波形函数,用过的请回复一声。
procedure Tform1.DrawWav(Filename:string;Position:word;range:word;Channels:word;bv:real);
var
f:file of byte;
i,n:longint;
x:byte;
ff:real;
xx,yy:word;
begin
assignfile(f,filename);
reset(f);
n:=filesize(f);
n:=n-44;
n:=n div (2*channels);
seek(f,44);
form1.Canvas.MoveTo(1,position);
for i:=1 to ndo
begin
read(f,x);
seek(f,filepos(f)+(2*channels-1));
if x>128 then
begin
ff:=position-(x-128)*range/128;
end
else
begin
if x<128 then
begin
ff:=position+(128-x)*range/128;
end
else
ff:=position;
end;
yy:=round(ff);
ff:=bv*i;
xx:=round(ff);
form1.Canvas.LineTo(xx,yy);
if xx>screen.Width then
break;
end;
closefile(f);
end;