Z
zhaofeng_z_f
Unregistered / Unconfirmed
GUEST, unregistred user!
真的搞不懂,为什么保存的文件都是0字节.
代码1:
var
spFileStream1 := TSpFileStream;
spVoice1 := TSpVoice;
begin
spFileStream1 := nil;
spVoice1 := nil;
try
spFileStream1 := TSpFileStream.Create(Self);
spVoice1 := TSpVoice1.Create();
spFileStream1.Open('c:/voice/zf.avi',SSFMCreateForWrite,False);
spVoice1.AudioOutputStream := spFileStream1.DefaultInterface;
spVoice1.Speak('中国',SVSFlagsAsync or SVSFPurgeBeforeSpeak or SVSFIsXML);
spVoice1.WaitUntilDone(-1);
spFileStream1.Close();
finally
if (spFileStream1 <> nil) then
spFileStream1.Free();
if (spVoice1 <> nil) then
spVoice1.Free();
end;
end;
代码2(类似sapi vb的例子)
var
spFileStream1 :SpFileStream;//接口
spVoice1 :SpVoice;
begin
spFileStream1 := CreateOleObject("SAPI.SpFileStream");
spVoice1 := CreateOleObject("SAPI.spVoice");
spFileStream1.Open('c:/voice/zf.avi',SSFMCreateForWrite,False);
spVoice1.AudioOutputStream := spFileStream1;//报错
spVoice1.Speak('中国',SVSFlagsAsync or SVSFPurgeBeforeSpeak or SVSFIsXML);
spVoice1.WaitUntilDone(-1);
spFileStream1.Close();
end;
代码1:
var
spFileStream1 := TSpFileStream;
spVoice1 := TSpVoice;
begin
spFileStream1 := nil;
spVoice1 := nil;
try
spFileStream1 := TSpFileStream.Create(Self);
spVoice1 := TSpVoice1.Create();
spFileStream1.Open('c:/voice/zf.avi',SSFMCreateForWrite,False);
spVoice1.AudioOutputStream := spFileStream1.DefaultInterface;
spVoice1.Speak('中国',SVSFlagsAsync or SVSFPurgeBeforeSpeak or SVSFIsXML);
spVoice1.WaitUntilDone(-1);
spFileStream1.Close();
finally
if (spFileStream1 <> nil) then
spFileStream1.Free();
if (spVoice1 <> nil) then
spVoice1.Free();
end;
end;
代码2(类似sapi vb的例子)
var
spFileStream1 :SpFileStream;//接口
spVoice1 :SpVoice;
begin
spFileStream1 := CreateOleObject("SAPI.SpFileStream");
spVoice1 := CreateOleObject("SAPI.spVoice");
spFileStream1.Open('c:/voice/zf.avi',SSFMCreateForWrite,False);
spVoice1.AudioOutputStream := spFileStream1;//报错
spVoice1.Speak('中国',SVSFlagsAsync or SVSFPurgeBeforeSpeak or SVSFIsXML);
spVoice1.WaitUntilDone(-1);
spFileStream1.Close();
end;