O
okook2003
Unregistered / Unconfirmed
GUEST, unregistred user!
我试了半天也没有调用成功,请DFW兄弟们帮忙呀,看看谁成功调用,给点建议或资料什么的,最好附调用成功的代码给我,我急用呢,谢谢了。[]
===============================================================================
//***********************************************************************//
// //
// 画放音时的动态波形 //
// 参数: //
// Buf : 音频数据指针 //
// Length : 音频数据的长度 //
// DesCanvas : 用来显示波形的目标画布 //
// DH, DW : 目标画布工作区的高度与宽度 //
// Min, Max : 音频数据的最小值与最大值 //
// DrawLineColor : 画波形的颜色 //
// DrawBackColor : 画波形的背景颜色 //
// StartPoi : 开始画波形的位置 //
// DrawLength : 要画的波形的数据的长度 //
// 返回值: 无 //
// //
//***********************************************************************//
procedure HawDrawWave(Buf: PChar; Length: LongInt; DesCanvas: TCanvas;
DH, DW: SmallInt; Min, Max: LongInt; DrawLineColor, DrawBackColor: TColor;
StartPoi: LongInt = 0; DrawLength: LongInt = 0);
Var
i: LongInt;
Y: SmallInt;
DesBitMap: TBitMap;
begin
DesBitMap := TBitMap.Create;
with DesBitMap do //初始化图像对像
begin
Width := DW;
Height := DH;
Canvas.Brush.Color := DrawBackColor;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := DrawLineColor;
Canvas.Pen.Mode := pmCopy;
Canvas.FillRect(Rect(0, 0, DW, DH));
Canvas.MoveTo(0, DH DIV 2);
Canvas.LineTo(DW, DH DIV 2);
end;
if ((Length = 0) or (Buf = NIL)) then
begin
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
Exit;
end;
if (StartPoi MOD 2) = 1 then
StartPoi := StartPoi + 1;
if StartPoi >= Length then
StartPoi := 2;
if DrawLength div 2 > DW then //开始处
DrawLength := DW * 2;
if (StartPoi + DrawLength) > Length then
DrawLength := Length - StartPoi;
if DrawLength <= 0 then
DrawLength := DW * 2;
Max := Max - Min;
for i := 0 to (DrawLength div 2 -1) do
begin
if Max <> 0 then
Y := Abs(PCMInt(PChar(Buf) + StartPoi + i * 2)^ - Min) * DH div Max
else
Y := 0;
Y := ABS(DH DIV 2 - Y);
if Y >= (DH DIV 2) then
continue;
//画波形
DesBitMap.Canvas.MoveTo(i, DH DIV 2 - Y);
DesBitMap.Canvas.LineTo(i, DH DIV 2 + Y);
if i > DW then break;
end;
//复制图像
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
DesBitMap.Free;
end;
==========================================================================================================
录音时的图形
//***********************************************************************//
// //
// 画局部音频数据的波形 //
// 参数: //
// Flag : 波形显示周期 //
// Buf : 音频数据 //
// Length : 音频数据的长度 //
// DesCanvas : 要显示波形的目标画布 //
// DH, DW : 目标画布的工作区域的高度与宽度 //
// DesBitMap : 画波形时用的非可视源位图对像 //
// DrawLineColor : 画波形的颜色 //
// DrawBackColor : 画波形的背景颜色 //
// Draw : 是否画波形 //
// 返回值: 无 //
// //
//***********************************************************************//
procedure DrawPartWave(const Flag: Integer; Buf: PChar; Length: LongInt;
DesCanvas: TCanvas; DH, DW: SmallInt; DesBitMap: TBitMap;
DrawLineColor, DrawBackColor: TColor; Draw: Boolean = True);
var
i, j, k, lmax, lmin: LongInt;
Max, Min: LongInt;
X, Y: SmallInt;
begin
with DesBitMap do //初始化图像参数
begin
Width := DW;
Height := DH;
Canvas.Brush.Color := DrawBackColor;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := DrawLineColor;
Canvas.Pen.Mode := pmCopy;
Canvas.FillRect(Rect(0, 0, DW, DH));
end;
if ((Length = 0) Or (Buf = NIL)) then
begin //清除
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
Exit;
end;
Max := -32768;
Min := 32767;
for i := 0 to (Length div 2 -1 ) do //取到最小值与最大值
begin
j := PCMInt(PChar(Buf) + i * 2)^;
if j > Max then Max := j;
if j < Min then Min := j;
end;
DrawMin := Min;
DrawMax := Max;
if Not Draw then
begin
Exit;
end;
Max := Max - Min; //最大振幅
DesBitMap.Canvas.MoveTo(0, DH div 2);
j := 0;
X := 0;
lmax := 0;
lmin := 32767;
for i := 0 to ((Length) div 2 -1) do
begin
if j < (Flag - 1) then //如果是在一个周期内
begin
INC(j);
end
else begin
j := 0;
X := X + 1;
lmax := 0;
lmin := 32767;
end;
if Max <> 0 then //取音频数据转换在整数
Y := Abs(PCMInt(PChar(buf) + i * 2)^ - Min) * DH div Max
else
Y := DH div 2;
k := 0;
if Y > lmax then
begin
lmax := Y;
k := 1;
end;
if Y < lmin then
begin
lmin := Y;
k := 1;
end;
if k = 1 then
DesBitMap.Canvas.LineTo(X, Y); //画线
if X > DW then break;
end;
//图像复制 拷贝
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
end;
=======================================================================================================
画WAV的图形函数:
//***********************************************************************//
// //
// 画全部音频数据的波形 //
// 参数: //
// Dw_Type : 波形显示数据记录 //
// WaveMin : 波形数据的最小值 //
// WaveMax : 波形数据的最大值 //
// DrawLineColor : 画波形的颜色 //
// DrawBackColor : 画波形的背景颜色 //
// Draw : 是否画波形 //
// 返回值: 无 //
// //
//***********************************************************************//
procedure DrawAllWave(Dw_Type: TDrawWave_Type; var WaveMin, WaveMax: LongInt;
DrawLineColor, DrawBackColor: TColor; Draw: Boolean = True);
var
Buf: PChar;
i, Loop, j, k, lmax, lmin: LongInt;
Max, Min: LongInt;
X, Y: SmallInt;
DrawLoop: LongInt;
MODDrawSize: LongInt;
LoadSize: LongInt;
hFile: Integer;
begin
Application.ProcessMessages;
hFile := 0;
DrawLoop := Dw_Type.Length DIV LoadMemSize;
MODDrawSize := 0;
if (Dw_Type.Length MOD LoadMemSize) <> 0 then
begin
DrawLoop := DrawLoop + 1;
MODDrawSize := Dw_Type.Length MOD LoadMemSize;
end;
SendMessage(Application.MainForm.Handle, CM_BEGINDRAW, DrawLoop * 3, 0);
with Dw_Type.DesBitMap do
begin
Width := Dw_Type.DW;
Height := Dw_Type.DH;
Canvas.Brush.Color := DrawBackColor;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := DrawLineColor;
Canvas.Pen.Mode := pmCopy;
Canvas.FillRect(Rect(0, 0, Dw_Type.DW, Dw_Type.DH));
end;
if Dw_Type.Length = 0 then
begin
BitBlt(Dw_Type.DesCanvas.Handle, 0, 0, Dw_Type.DW, Dw_Type.DH,
Dw_Type.DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
Exit;
end;
case Dw_Type.FileType of //不同的方式,打开不同的文件
//移到文件音频数据开始处
CS_SAVE_PLAY: mmioSeek(Dw_Type.hio, Dw_Type.Length, SEEK_END); //播方方式
CS_SAVE_RECORD: hFile := FileOpen(Dw_Type.FileName, fmOpenRead); //录音方式
end;
Max := -32768;
Min := 32767;
Try
for Loop := 1 to DrawLoop do
begin
if (MODDrawSize <> 0) AND (Loop = DrawLoop) then
LoadSize := MODDrawSize //要播放的音频数据的长度
else
LoadSize := LoadMemSize;
//开辟内存
Buf := PChar(GlobalAllocPtr(GMEM_MOVEABLE or GMEM_SHARE, LoadMemSize));
if Buf = NIL then
raise EMMIO.Create('不能分配内存!');
Try
case Dw_Type.FileType of //读音频数
CS_SAVE_PLAY: mmioRead(Dw_Type.hio, Buf, LoadSize);
CS_SAVE_RECORD: FileRead(hFile, Buf^, LoadSize);
end;
if Dw_Type.Length <= LoadMemSize then //假如小于区域长度的最大长度
begin //画区域波形
DrawPartWave(Dw_Type.Flag, Buf, Dw_Type.Length, Dw_Type.DesCanvas,
Dw_Type.DH, Dw_Type.DW, Dw_Type.DesBitMap, DrawLineColor,
DrawBackColor, Draw);
WaveMin := DrawMin;
WaveMax := DrawMax;
SendMessage(Application.MainForm.Handle, CM_DRAWPOSI, DrawLoop * 3, 0);
SendMessage(Application.MainForm.Handle, CM_ENDDRAW, 0, 0);
FileClose(hFile);
Exit;
end;
for i := 0 to (LoadSize div 2 - 1) do
begin //取最大最小值
j := PCMInt(PChar(Buf)+ i * 2)^;
if j > Max then Max := j;
if j < Min then Min := j;
end;
Finally
GloBalFreePtr(Buf);
end;
SendMessage(Application.MainForm.Handle, CM_DRAWPOSI, DrawLoop, 0);
end;
Finally
FileClose(hFile);
end;
WaveMin := Min;
WaveMax := Max;
if Not Draw then
begin
if Dw_Type.FileType = CS_SAVE_RECORD then FileClose(hFile);
SendMessage(Application.MainForm.Handle, CM_ENDDRAW, 0, 0);
Exit;
end;
Max := Max - Min;
Dw_Type.DesBitMap.Canvas.MoveTo(0, Dw_Type.DH div 2);
j := 0;
X := 0;
lmax := 0;
lmin := 32767;
hFile := 0;
case Dw_Type.FileType of //移到文件开始处
CS_SAVE_PLAY: mmioSeek(Dw_Type.hio, Dw_Type.Length, SEEK_END);
CS_SAVE_RECORD: hFile := FileOpen(Dw_Type.FileName, fmOpenRead);
else
hFile := 0;
end;
Try
for Loop := 1 to DrawLoop do
begin
if (MODDrawSize <> 0) AND (Loop = DrawLoop) then
begin
//开辟内存
Buf := PChar(GlobalAllocPtr(GMEM_MOVEABLE or GMEM_SHARE, MODDrawSize));
LoadSize := MODDrawSize; //要播放的音频数据的长度
end
else begin
Buf := PChar(GlobalAllocPtr(GMEM_MOVEABLE or GMEM_SHARE, LoadMemSize));
LoadSize := LoadMemSize;
end;
if Buf = NIL then
raise EMMIO.Create('不能分配内存!');
Try
case Dw_Type.FileType of
CS_SAVE_PLAY: mmioRead(Dw_Type.hio, Buf, LoadSize);
CS_SAVE_RECORD: FileRead(hFile, Buf^, LoadSize);
end;
for i := 0 to (LoadSize div 2 - 1 ) do
begin
if j < (Dw_Type.Flag - 1) then //在同一周期内
begin
INC(j);
end
else begin
j := 0;
X := X + 1;
lmax := 0;
lmin := 32767;
end;
if Max <> 0 then
Y := Abs(PCMInt(PChar(Buf) + i * 2)^ - Min) * Dw_Type.DH div Max
else
Y := Dw_Type.DH div 2;
k := 0;
if Y > lmax then
begin
lmax := Y;
k := 1;
end;
if Y < lmin then
begin
lmin := Y;
k := 1;
end;
if k = 1 then
Dw_Type.DesBitMap.Canvas.LineTo(X, Y);
if X > Dw_Type.DW then break;
end;
Finally
GloBalFreePtr(Buf);
end;
SendMessage(Application.MainForm.Handle, CM_DRAWPOSI, DrawLoop + Loop * 2 , 0);
end;
Finally
FileClose(hFile);
end;
//复制图像
BitBlt(Dw_Type.DesCanvas.Handle, 0, 0, Dw_Type.DW, Dw_Type.DH,
Dw_Type.DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
SendMessage(Application.MainForm.Handle, CM_ENDDRAW, 0, 0);
end;
================================================================================
===============================================================================
//***********************************************************************//
// //
// 画放音时的动态波形 //
// 参数: //
// Buf : 音频数据指针 //
// Length : 音频数据的长度 //
// DesCanvas : 用来显示波形的目标画布 //
// DH, DW : 目标画布工作区的高度与宽度 //
// Min, Max : 音频数据的最小值与最大值 //
// DrawLineColor : 画波形的颜色 //
// DrawBackColor : 画波形的背景颜色 //
// StartPoi : 开始画波形的位置 //
// DrawLength : 要画的波形的数据的长度 //
// 返回值: 无 //
// //
//***********************************************************************//
procedure HawDrawWave(Buf: PChar; Length: LongInt; DesCanvas: TCanvas;
DH, DW: SmallInt; Min, Max: LongInt; DrawLineColor, DrawBackColor: TColor;
StartPoi: LongInt = 0; DrawLength: LongInt = 0);
Var
i: LongInt;
Y: SmallInt;
DesBitMap: TBitMap;
begin
DesBitMap := TBitMap.Create;
with DesBitMap do //初始化图像对像
begin
Width := DW;
Height := DH;
Canvas.Brush.Color := DrawBackColor;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := DrawLineColor;
Canvas.Pen.Mode := pmCopy;
Canvas.FillRect(Rect(0, 0, DW, DH));
Canvas.MoveTo(0, DH DIV 2);
Canvas.LineTo(DW, DH DIV 2);
end;
if ((Length = 0) or (Buf = NIL)) then
begin
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
Exit;
end;
if (StartPoi MOD 2) = 1 then
StartPoi := StartPoi + 1;
if StartPoi >= Length then
StartPoi := 2;
if DrawLength div 2 > DW then //开始处
DrawLength := DW * 2;
if (StartPoi + DrawLength) > Length then
DrawLength := Length - StartPoi;
if DrawLength <= 0 then
DrawLength := DW * 2;
Max := Max - Min;
for i := 0 to (DrawLength div 2 -1) do
begin
if Max <> 0 then
Y := Abs(PCMInt(PChar(Buf) + StartPoi + i * 2)^ - Min) * DH div Max
else
Y := 0;
Y := ABS(DH DIV 2 - Y);
if Y >= (DH DIV 2) then
continue;
//画波形
DesBitMap.Canvas.MoveTo(i, DH DIV 2 - Y);
DesBitMap.Canvas.LineTo(i, DH DIV 2 + Y);
if i > DW then break;
end;
//复制图像
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
DesBitMap.Free;
end;
==========================================================================================================
录音时的图形
//***********************************************************************//
// //
// 画局部音频数据的波形 //
// 参数: //
// Flag : 波形显示周期 //
// Buf : 音频数据 //
// Length : 音频数据的长度 //
// DesCanvas : 要显示波形的目标画布 //
// DH, DW : 目标画布的工作区域的高度与宽度 //
// DesBitMap : 画波形时用的非可视源位图对像 //
// DrawLineColor : 画波形的颜色 //
// DrawBackColor : 画波形的背景颜色 //
// Draw : 是否画波形 //
// 返回值: 无 //
// //
//***********************************************************************//
procedure DrawPartWave(const Flag: Integer; Buf: PChar; Length: LongInt;
DesCanvas: TCanvas; DH, DW: SmallInt; DesBitMap: TBitMap;
DrawLineColor, DrawBackColor: TColor; Draw: Boolean = True);
var
i, j, k, lmax, lmin: LongInt;
Max, Min: LongInt;
X, Y: SmallInt;
begin
with DesBitMap do //初始化图像参数
begin
Width := DW;
Height := DH;
Canvas.Brush.Color := DrawBackColor;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := DrawLineColor;
Canvas.Pen.Mode := pmCopy;
Canvas.FillRect(Rect(0, 0, DW, DH));
end;
if ((Length = 0) Or (Buf = NIL)) then
begin //清除
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
Exit;
end;
Max := -32768;
Min := 32767;
for i := 0 to (Length div 2 -1 ) do //取到最小值与最大值
begin
j := PCMInt(PChar(Buf) + i * 2)^;
if j > Max then Max := j;
if j < Min then Min := j;
end;
DrawMin := Min;
DrawMax := Max;
if Not Draw then
begin
Exit;
end;
Max := Max - Min; //最大振幅
DesBitMap.Canvas.MoveTo(0, DH div 2);
j := 0;
X := 0;
lmax := 0;
lmin := 32767;
for i := 0 to ((Length) div 2 -1) do
begin
if j < (Flag - 1) then //如果是在一个周期内
begin
INC(j);
end
else begin
j := 0;
X := X + 1;
lmax := 0;
lmin := 32767;
end;
if Max <> 0 then //取音频数据转换在整数
Y := Abs(PCMInt(PChar(buf) + i * 2)^ - Min) * DH div Max
else
Y := DH div 2;
k := 0;
if Y > lmax then
begin
lmax := Y;
k := 1;
end;
if Y < lmin then
begin
lmin := Y;
k := 1;
end;
if k = 1 then
DesBitMap.Canvas.LineTo(X, Y); //画线
if X > DW then break;
end;
//图像复制 拷贝
BitBlt(DesCanvas.Handle, 0, 0, DW, DH, DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
end;
=======================================================================================================
画WAV的图形函数:
//***********************************************************************//
// //
// 画全部音频数据的波形 //
// 参数: //
// Dw_Type : 波形显示数据记录 //
// WaveMin : 波形数据的最小值 //
// WaveMax : 波形数据的最大值 //
// DrawLineColor : 画波形的颜色 //
// DrawBackColor : 画波形的背景颜色 //
// Draw : 是否画波形 //
// 返回值: 无 //
// //
//***********************************************************************//
procedure DrawAllWave(Dw_Type: TDrawWave_Type; var WaveMin, WaveMax: LongInt;
DrawLineColor, DrawBackColor: TColor; Draw: Boolean = True);
var
Buf: PChar;
i, Loop, j, k, lmax, lmin: LongInt;
Max, Min: LongInt;
X, Y: SmallInt;
DrawLoop: LongInt;
MODDrawSize: LongInt;
LoadSize: LongInt;
hFile: Integer;
begin
Application.ProcessMessages;
hFile := 0;
DrawLoop := Dw_Type.Length DIV LoadMemSize;
MODDrawSize := 0;
if (Dw_Type.Length MOD LoadMemSize) <> 0 then
begin
DrawLoop := DrawLoop + 1;
MODDrawSize := Dw_Type.Length MOD LoadMemSize;
end;
SendMessage(Application.MainForm.Handle, CM_BEGINDRAW, DrawLoop * 3, 0);
with Dw_Type.DesBitMap do
begin
Width := Dw_Type.DW;
Height := Dw_Type.DH;
Canvas.Brush.Color := DrawBackColor;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := DrawLineColor;
Canvas.Pen.Mode := pmCopy;
Canvas.FillRect(Rect(0, 0, Dw_Type.DW, Dw_Type.DH));
end;
if Dw_Type.Length = 0 then
begin
BitBlt(Dw_Type.DesCanvas.Handle, 0, 0, Dw_Type.DW, Dw_Type.DH,
Dw_Type.DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
Exit;
end;
case Dw_Type.FileType of //不同的方式,打开不同的文件
//移到文件音频数据开始处
CS_SAVE_PLAY: mmioSeek(Dw_Type.hio, Dw_Type.Length, SEEK_END); //播方方式
CS_SAVE_RECORD: hFile := FileOpen(Dw_Type.FileName, fmOpenRead); //录音方式
end;
Max := -32768;
Min := 32767;
Try
for Loop := 1 to DrawLoop do
begin
if (MODDrawSize <> 0) AND (Loop = DrawLoop) then
LoadSize := MODDrawSize //要播放的音频数据的长度
else
LoadSize := LoadMemSize;
//开辟内存
Buf := PChar(GlobalAllocPtr(GMEM_MOVEABLE or GMEM_SHARE, LoadMemSize));
if Buf = NIL then
raise EMMIO.Create('不能分配内存!');
Try
case Dw_Type.FileType of //读音频数
CS_SAVE_PLAY: mmioRead(Dw_Type.hio, Buf, LoadSize);
CS_SAVE_RECORD: FileRead(hFile, Buf^, LoadSize);
end;
if Dw_Type.Length <= LoadMemSize then //假如小于区域长度的最大长度
begin //画区域波形
DrawPartWave(Dw_Type.Flag, Buf, Dw_Type.Length, Dw_Type.DesCanvas,
Dw_Type.DH, Dw_Type.DW, Dw_Type.DesBitMap, DrawLineColor,
DrawBackColor, Draw);
WaveMin := DrawMin;
WaveMax := DrawMax;
SendMessage(Application.MainForm.Handle, CM_DRAWPOSI, DrawLoop * 3, 0);
SendMessage(Application.MainForm.Handle, CM_ENDDRAW, 0, 0);
FileClose(hFile);
Exit;
end;
for i := 0 to (LoadSize div 2 - 1) do
begin //取最大最小值
j := PCMInt(PChar(Buf)+ i * 2)^;
if j > Max then Max := j;
if j < Min then Min := j;
end;
Finally
GloBalFreePtr(Buf);
end;
SendMessage(Application.MainForm.Handle, CM_DRAWPOSI, DrawLoop, 0);
end;
Finally
FileClose(hFile);
end;
WaveMin := Min;
WaveMax := Max;
if Not Draw then
begin
if Dw_Type.FileType = CS_SAVE_RECORD then FileClose(hFile);
SendMessage(Application.MainForm.Handle, CM_ENDDRAW, 0, 0);
Exit;
end;
Max := Max - Min;
Dw_Type.DesBitMap.Canvas.MoveTo(0, Dw_Type.DH div 2);
j := 0;
X := 0;
lmax := 0;
lmin := 32767;
hFile := 0;
case Dw_Type.FileType of //移到文件开始处
CS_SAVE_PLAY: mmioSeek(Dw_Type.hio, Dw_Type.Length, SEEK_END);
CS_SAVE_RECORD: hFile := FileOpen(Dw_Type.FileName, fmOpenRead);
else
hFile := 0;
end;
Try
for Loop := 1 to DrawLoop do
begin
if (MODDrawSize <> 0) AND (Loop = DrawLoop) then
begin
//开辟内存
Buf := PChar(GlobalAllocPtr(GMEM_MOVEABLE or GMEM_SHARE, MODDrawSize));
LoadSize := MODDrawSize; //要播放的音频数据的长度
end
else begin
Buf := PChar(GlobalAllocPtr(GMEM_MOVEABLE or GMEM_SHARE, LoadMemSize));
LoadSize := LoadMemSize;
end;
if Buf = NIL then
raise EMMIO.Create('不能分配内存!');
Try
case Dw_Type.FileType of
CS_SAVE_PLAY: mmioRead(Dw_Type.hio, Buf, LoadSize);
CS_SAVE_RECORD: FileRead(hFile, Buf^, LoadSize);
end;
for i := 0 to (LoadSize div 2 - 1 ) do
begin
if j < (Dw_Type.Flag - 1) then //在同一周期内
begin
INC(j);
end
else begin
j := 0;
X := X + 1;
lmax := 0;
lmin := 32767;
end;
if Max <> 0 then
Y := Abs(PCMInt(PChar(Buf) + i * 2)^ - Min) * Dw_Type.DH div Max
else
Y := Dw_Type.DH div 2;
k := 0;
if Y > lmax then
begin
lmax := Y;
k := 1;
end;
if Y < lmin then
begin
lmin := Y;
k := 1;
end;
if k = 1 then
Dw_Type.DesBitMap.Canvas.LineTo(X, Y);
if X > Dw_Type.DW then break;
end;
Finally
GloBalFreePtr(Buf);
end;
SendMessage(Application.MainForm.Handle, CM_DRAWPOSI, DrawLoop + Loop * 2 , 0);
end;
Finally
FileClose(hFile);
end;
//复制图像
BitBlt(Dw_Type.DesCanvas.Handle, 0, 0, Dw_Type.DW, Dw_Type.DH,
Dw_Type.DesBitMap.Canvas.Handle, 0, 0, SRCCOPY);
SendMessage(Application.MainForm.Handle, CM_ENDDRAW, 0, 0);
end;
================================================================================