function Tform.ToWav(WavFileName: String): Boolean;
var
B: array[0..45] of byte;
J, wy_length: LongInt;
I: Integer;
wy_penc, wy_penc1: PChar;
AStream: TMemoryStream;
begin
if FStream.Size > 0 then
begin
Result := True;
for I:=1 to 45do
B:=0;
B[0] := $52;
b[1] := $49;
b[2] := $46;
b[3] := $46;
B[8] := $57;
b[9] := $41;
b[10] := $56;
b[11] := $45;
B[12]:= $66;
b[13] := $6D;
b[14] := $74;
b[15] := $20;
B[16]:= $12;
b[20] := 6;
b[22] := 1;
b[24] := $40;
B[25]:= $1F;
b[28] := $40;
b[29] := $1F;
b[32] := 1;
B[34]:= 8;
b[38] := $64;
b[39] := $61;
b[40] := $74;
B[41]:= $61;
wy_length := FStream.size;
J := wy_length + 38;
b[4] := J And 255;
b[5] := (J And $FF00) div 255;
b[6] := (J And $FF0000) div $FFFF;
b[7] := (J And $FF000000) div $FFFFFF;
b[42] := wy_length And 255;
b[43] := (wy_length And $FF00) div 255;
b[44] := (wy_length And $FF0000) div $FFFF;
b[45] := (wy_length And $FF000000) div $FFFFFF;
try
try
AStream := TMemoryStream.Create;
AStream.LoadFromStream(FStream);
AStream.SetSize(wy_length + 47);
wy_penc := AStream.Memory;
for i := 0 to 45do
wy_penc := char(b);
wy_penc1 := FStream.Memory;
AStream.Position := 46;
for i := 46 to wy_lengthdo
begin
wy_penc := wy_penc1[i-46];
end;
if Not DirectoryExists(ExtractFilePath(WavFileName)) then
ForceDirectories(ExtractFilePath(WavFileName));
AStream.SaveToFile(WavFileName);
except
Application.MessageBox('文件格式转换失败!', '提示', MB_OK + MB_ICONINFORMATION);
Result := False;
end;
finally
AStream.Free;
end;
end else
Result := False;
end;