以下工作完美(Delphi 7):
procedure TMainForm.SayIt(s:string); // s is the string to be spoken
var
voice: OLEVariant;
begin
memo1.setfocus;
voice := CreateOLEObject ('SAPI.SpVoice');
voice.Voice := voice.GetVoices.Item(combobox1.ItemIndex); // current voice selected
voice.volume := tbVolume.position;
voice.rate := tbRate.position;
voice.Speak (s, SVSFDefault);
end;
Run Code Online (Sandbox Code Playgroud)
以上工作在"同步"模式(SVSFDefault标志),但如果我在尝试以异步模式播放声音时将标志更改为SVSFlagsAsync,则不会产生声音.没有给出错误消息,但扬声器上没有播放任何内容.
问题可能是什么?我在Delphi的Imports文件夹中有SpeechLib_TLB单元.
编辑:这是在Windows XP中
谢谢,布鲁诺.