请问Delphi 使用WaveIn 进行Wav录音时,停止录音以后如何才能将录音的内容存储
为文件呢?
使用MediaPlayer
1、录音
var
sd,yz,pl:integer;
begin
pl:=11025;
if ssd.ItemIndex=0 then sd:=1 else sd:=2;
if syz.ItemIndex=0 then yz:=8 else yz:=16;
if spl.ItemIndex=0 then pl:=11025
else if spl.ItemIndex=1 then pl:=22050
else if spl.ItemIndex=2 then pl:=44100;
try
//在程序当前目录下创建一个Wav文件Temp.wav
CreateWav(sd, yz, pl, (ExtractFilePath(Application.ExeName)+ 'Temp.wav'));
MediaPlayer1.DeviceType := dtAutoSelect;
MediaPlayer1.FileName := (ExtractFilePath(Application.ExeName)+ 'Temp.wav');
MediaPlayer1.Open;
MediaPlayer1.StartRecording;
except
end;
end;
2、停止录音、保存
MediaPlayer1.Stop;
MediaPlayer1.Save;
MediaPlayer1.Close;
3、拷贝录音文件,将Temp.wav 复制到指定目录,取新的文件