如何在delphi中用mci函数实现录音功能啊(50分)

  • 主题发起人 主题发起人 sunnauq
  • 开始时间 开始时间
S

sunnauq

Unregistered / Unconfirmed
GUEST, unregistred user!

如何在delphi中用mci函数实现录音功能啊
 
1.用MMSystem中的WaveInOpen之类的函数
2.用MCI的mciSendCommand,mciSendString
3.用DirectSoundCapture

type
TWavHeader = record //定义一个Wav文件头格式
rId : longint;

rLen : longint;

wId : longint;

fId : longint;

fLen : longint;

wFormatTag : word;

nChannels : word;
nSamplesPerSec : longint;

nAvgBytesPerSec : longint;

nBlockAlign : word;

wBitsPerSample : word;
dId : longint;

wSampleLength : longint;
end;


procedure TForm1.CreateWav( channels : word;
{ 1(单声)或者2(立体声) }
resolution : word;
{ 8或者16,代表8位或16位声音 }
rate : longint;
{ 声音频率,如11025,22050, 44100}
fn : string { 对应的文件名称 } );
var
wf : file of TWavHeader;
wh : TWavHeader;
begin

wh.rId := $46464952;
wh.rLen := 36;
wh.wId := $45564157;
wh.fId := $20746d66;
wh.fLen := 16;
wh.wFormatTag := 1;
wh.nChannels := channels;
wh.nSamplesPerSec := rate;
wh.nAvgBytesPerSec := channels*rate*(resolution div 8);
wh.nBlockAlign := channels*(resolution div 8);
wh.wBitsPerSample := resolution;
wh.dId := $61746164;
wh.wSampleLength := 0;

assignfile(wf,fn);
{打开对应文件 }
rewrite(wf);
{移动指针到文件头}
write(wf,wh);
{写进文件头 }
closefile(wf);
{关闭文件 }
end;


mediaplayer1.DeviceType := dtAutoSelect;
mediaplayer1.FileName := FlatEdit1.text;
mediaplayer1.Open;
mediaplayer1.StartRecording;
 
接受答案了.
 
后退
顶部