有没有人用过杭州中正的,指纹仪(50分)

  • 主题发起人 主题发起人 baihj
  • 开始时间 开始时间
B

baihj

Unregistered / Unconfirmed
GUEST, unregistred user!
如果有用过的,一起讨论一下,给分
 
现在的问题是这样的,他们给的dll库 <br>函数原型 int WINAPI MXReadFingerFromSensor(unsigned char*FingerBuf);<br>我在delphi 中 ,改为 &nbsp;<br> &nbsp;Function &nbsp;MXDetectFinger(FingerBuf :array of pchar):integer ; stdcall ;external 'MXOTDLL.dll' name 'MXDetectFinger';<br>为什么一执行时就报错呢?
 
谁能详细讲讲tts的控制,这分就给他了
 
话题427636的标题是: 微软TTS语音引擎如何更换男女声?(急!) (300分)<br>分类:非技术问题 009 (2000-12-29 9:51:00) &nbsp;<br><br> <br>006 (2000-12-29 12:15:00) &nbsp;<br>我也想知道 <br> <br>wjiachun (2000-12-29 13:26:00) &nbsp;<br>?? <br> <br>visualabc (2000-12-29 13:29:00) &nbsp;<br>好象是换*。DIC吧<br>我也清楚。不要问我 <br> <br>cat.yy (2000-12-29 15:59:00) &nbsp;<br>? <br> <br>009 (2000-12-29 18:09:00) &nbsp;<br>到底有没有人会呀?<br>全是问号什么意思?骗分吗? <br> <br>枫 (2000-12-29 22:59:00) &nbsp;<br>我想应该在TTS里的SDK里有解释 <br> <br>房客 (2000-12-30 0:20:00) &nbsp;<br>金山词霸发声使用的是微软TTS引擎。 <br>如果是基于金山词霸:<br>硬盘上目录<br>c:/program files/common files/microsoft shared/speechenglish/tts<br>女声:<br>female.cfg<br>female.vce<br>female8.cfg<br>female8.vce//都删了就成男声了<br><br>//下边是如何调用<br>工程菜单中的导入类型库菜单,选择windows/ <br>speech目录下的vtxtauto.tlb文件,<br>单击确定后delphi会自动生成vtxauto_TLB.pas文件,它包含了TTS的com接口。 <br>应用如下: <br>uses vtxauto_TLB; <br>var TTS: ivtxtauto; <br>用前: <br>TTS:=covtxtauto_.Create ; <br>TTS.Register('project1','project1'); <br>用后: <br>TTS:=nil; <br>TTs.speak('要读的字符串',vtxtst_reading); <br>TTs.stopspeaking; // 停止 <br>TTs.set_speed(1); // 速度 <br><br> <br>009 (2000-12-30 9:31:00) &nbsp;<br>楼上的,我指的是程序中如何实现?删文件的方法太没有专业精神了吧? <br> <br>CJ (2000-12-30 13:44:00) &nbsp;<br>//a component I've used, it works good<br><br>unit mSpeech;<br><br>{<br> &nbsp;Monster Speech 1.1.0<br> &nbsp;written by Chen Yu (monster)<br><br> &nbsp;E-Mail: mftp@21cn.com &nbsp; ICQ UIN: 6740755<br> &nbsp;Homepage: http://homepages.msn.com/RedmondAve/mftp/<br><br> &nbsp;Suggestions and bug reports are warm welcomed.<br><br> &nbsp;This file used a Delphi translation of Speech API from<br> &nbsp;Project JEDI, and full package of this translation can<br> &nbsp;be found on JEDI's web page: http://www.delphi-jedi.org/<br>}<br><br>interface<br><br>uses<br> &nbsp;Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> &nbsp;ComObj, ActiveX, Speech;<br><br>{$I mspeech.msg}<br><br>type<br> &nbsp; TMSpeechEngineInfo = record<br> &nbsp; &nbsp; &nbsp;Name: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String;<br> &nbsp; &nbsp; &nbsp;Language: &nbsp; &nbsp; &nbsp; &nbsp; String;<br> &nbsp; &nbsp; &nbsp;Manufacturer: &nbsp; &nbsp; String;<br> &nbsp; &nbsp; &nbsp;Product: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String;<br> &nbsp; &nbsp; &nbsp;ModeID: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String;<br> &nbsp; &nbsp; &nbsp;EngineID: &nbsp; &nbsp; &nbsp; &nbsp; String;<br> &nbsp; &nbsp; &nbsp;Speaker: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String;<br> &nbsp; &nbsp; &nbsp;Style: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String;<br> &nbsp; &nbsp; &nbsp;Gender: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String;<br> &nbsp; &nbsp; &nbsp;Age: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Integer;<br> &nbsp; &nbsp; &nbsp;Features: &nbsp; &nbsp; &nbsp; &nbsp; Integer;<br> &nbsp; &nbsp; &nbsp;Interfaces: &nbsp; &nbsp; &nbsp; Integer;<br> &nbsp; &nbsp; &nbsp;MaxPitch: &nbsp; &nbsp; &nbsp; &nbsp; Word;<br> &nbsp; &nbsp; &nbsp;MinPitch: &nbsp; &nbsp; &nbsp; &nbsp; Word;<br> &nbsp; &nbsp; &nbsp;MaxRealTime: &nbsp; &nbsp; &nbsp;LongWord;<br> &nbsp; &nbsp; &nbsp;MinRealTime: &nbsp; &nbsp; &nbsp;LongWord;<br> &nbsp; &nbsp; &nbsp;MaxSpeed: &nbsp; &nbsp; &nbsp; &nbsp; LongWord;<br> &nbsp; &nbsp; &nbsp;MinSpeed: &nbsp; &nbsp; &nbsp; &nbsp; LongWord;<br> &nbsp; &nbsp; &nbsp;MaxVolume: &nbsp; &nbsp; &nbsp; &nbsp;LongWord;<br> &nbsp; &nbsp; &nbsp;MinVolume: &nbsp; &nbsp; &nbsp; &nbsp;LongWord;<br> &nbsp; end;<br><br> &nbsp; TSpeechDialog = (sdAbout, sdGeneral, sdLexicon, sdTranslate);<br> &nbsp; TSpeechOutput = (soFile, soGeneral);<br> &nbsp; TMSVisualEvent = procedure(Sender: TObject; Hints: LongWord; Mouth: PTTSMouth) of object;<br><br>type<br> &nbsp; EMSpeechException = class(Exception);<br> &nbsp; TMSpeech = class;<br><br> &nbsp; TTSNotifySink = class(TInterfacedObject, ITTSNotifySink)<br> &nbsp; private<br> &nbsp; &nbsp; &nbsp;FOwner: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TMSpeech;<br> &nbsp; protected<br> &nbsp; &nbsp; &nbsp;function AttribChanged(dwAttribute: DWORD): HResult; stdcall;<br> &nbsp; &nbsp; &nbsp;function AudioStart(qTimeStamp: QWORD): HResult; stdcall;<br> &nbsp; &nbsp; &nbsp;function AudioStop(qTimeStamp: QWORD): HResult; stdcall;<br> &nbsp; &nbsp; &nbsp;function Visual(qTimeStamp: QWORD;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cIPAPhoneme: Char;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cEnginePhoneme: Char;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dwHints: DWORD;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;apTTSMouth: PTTSMouth): HResult; stdcall;<br> &nbsp; public<br> &nbsp; &nbsp; &nbsp;constructor Create(AOwner: TMSpeech);<br> &nbsp; end;<br><br> &nbsp; TTSBufNotifySink = class(TInterfacedObject, ITTSBufNotifySink)<br> &nbsp; private<br> &nbsp; &nbsp; &nbsp;FOwner: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TMSpeech;<br> &nbsp; protected<br> &nbsp; &nbsp; &nbsp;function TextDataDone(qTimeStamp: QWORD; dwFlags: DWORD): HResult; stdcall;<br> &nbsp; &nbsp; &nbsp;function TextDataStarted(qTimeStamp: QWORD): HResult; stdcall;<br> &nbsp; &nbsp; &nbsp;function BookMark(qTimeStamp: QWORD; dwMarkNum: DWORD): HResult; stdcall;<br> &nbsp; &nbsp; &nbsp;function WordPosition(qTimeStamp: QWORD; dwByteOffset: DWORD): HResult; stdcall;<br> &nbsp; public<br> &nbsp; &nbsp; &nbsp;constructor Create(AOwner: TMSpeech);<br> &nbsp; end;<br><br> &nbsp; TMSpeech = class(TComponent)<br> &nbsp; private<br> &nbsp; &nbsp; &nbsp;FEngines: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TStrings;<br> &nbsp; &nbsp; &nbsp;FEngineStarted: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Boolean;<br> &nbsp; &nbsp; &nbsp;FFile: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WideString;<br> &nbsp; &nbsp; &nbsp;FIAF: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IAudioFile;<br> &nbsp; &nbsp; &nbsp;FIAMD: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IAudioMultimediaDevice;<br> &nbsp; &nbsp; &nbsp;FInfo: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TMSpeechEngineInfo;<br> &nbsp; &nbsp; &nbsp;FInit: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Boolean;<br> &nbsp; &nbsp; &nbsp;FITTSAttributes: &nbsp; &nbsp; &nbsp; &nbsp; ITTSAttributes;<br> &nbsp; &nbsp; &nbsp;FITTSCentral: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ITTSCentral;<br> &nbsp; &nbsp; &nbsp;FITTSDialogs: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ITTSDialogs;<br> &nbsp; &nbsp; &nbsp;FITTSEnum: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ITTSEnum;<br> &nbsp; &nbsp; &nbsp;FKey: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LongWord;<br> &nbsp; &nbsp; &nbsp;FOutput: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TSpeechOutput;<br> &nbsp; &nbsp; &nbsp;FPaused: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Boolean;<br> &nbsp; &nbsp; &nbsp;FText: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TStrings;<br> &nbsp; &nbsp; &nbsp;FTTSNotifySink: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ITTSNotifySink;<br> &nbsp; &nbsp; &nbsp;FTTSBufNotifySink: &nbsp; &nbsp; &nbsp; ITTSBufNotifySink;<br> &nbsp; &nbsp; &nbsp;FVersion, DummyS: &nbsp; &nbsp; &nbsp; &nbsp;String;<br> &nbsp; &nbsp; &nbsp;PModeInfo: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PTTSModeInfo;<br><br> &nbsp; &nbsp; &nbsp;function GetInterface(Index: Integer): IUnknown;<br> &nbsp; &nbsp; &nbsp;function GetPitch: Word;<br> &nbsp; &nbsp; &nbsp;function GetRealTime: LongWord;<br> &nbsp; &nbsp; &nbsp;function GetSpeed: LongWord;<br> &nbsp; &nbsp; &nbsp;function GetVolume: LongWord;<br> &nbsp; &nbsp; &nbsp;procedure SetText(const Value: TStrings);<br> &nbsp; &nbsp; &nbsp;procedure SetPitch(const Value: Word);<br> &nbsp; &nbsp; &nbsp;procedure SetRealTime(const Value: LongWord);<br> &nbsp; &nbsp; &nbsp;procedure SetSpeed(const Value: LongWord);<br> &nbsp; &nbsp; &nbsp;procedure SetVolume(const Value: LongWord);<br><br> &nbsp; &nbsp; &nbsp;procedure BeforeSelectEngine;<br> &nbsp; &nbsp; &nbsp;procedure Init;<br> &nbsp; &nbsp; &nbsp;procedure InitAudio;<br> &nbsp; &nbsp; &nbsp;procedure PostSelectEngine;<br> &nbsp; &nbsp; &nbsp;procedure PostSelectEngine2(ModeInfo: TTSModeInfo);<br><br> &nbsp; &nbsp; &nbsp;function GetAudioDevice: IUnknown;<br> &nbsp; protected<br> &nbsp; &nbsp; &nbsp;FOnStart, FOnStop: &nbsp; &nbsp; &nbsp; TNotifyEvent;<br> &nbsp; &nbsp; &nbsp;FOnVisual: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TMSVisualEvent;<br> &nbsp; &nbsp; &nbsp;FPos: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LongWord;<br><br> &nbsp; &nbsp; &nbsp;procedure FlushFile;<br> &nbsp; public<br> &nbsp; &nbsp; &nbsp;constructor Create(AOwner: TComponent); override;<br> &nbsp; &nbsp; &nbsp;destructor Destroy; override;<br> &nbsp; &nbsp; &nbsp;procedure Inject(Command: String);<br> &nbsp; &nbsp; &nbsp;procedure Pause;<br> &nbsp; &nbsp; &nbsp;procedure Resume;<br> &nbsp; &nbsp; &nbsp;procedure SelectEngine(EngineName: String); overload;<br> &nbsp; &nbsp; &nbsp;procedure SelectEngine(EngineMode: TTSModeInfo); overload;<br> &nbsp; &nbsp; &nbsp;procedure Show(DialogType: TSpeechDialog; ParentWnd: HWND = 0);<br> &nbsp; &nbsp; &nbsp;procedure Speak;<br> &nbsp; &nbsp; &nbsp;procedure Stop;<br><br> &nbsp; &nbsp; &nbsp;function GetEngineInfo(EngineName: String; var Info: TMSpeechEngineInfo): Boolean;<br><br> &nbsp; &nbsp; &nbsp;property Engines: TStrings read FEngines;<br> &nbsp; &nbsp; &nbsp;property Info: TMSpeechEngineInfo read FInfo;<br> &nbsp; &nbsp; &nbsp;property Interfaces[Index: Integer]: IUnknown read GetInterface;<br> &nbsp; &nbsp; &nbsp;property Paused: Boolean read FPaused;<br> &nbsp; &nbsp; &nbsp;property Pitch: Word read GetPitch write SetPitch;<br> &nbsp; &nbsp; &nbsp;property Position: LongWord read FPos;<br> &nbsp; &nbsp; &nbsp;property RealTime: LongWord read GetRealTime write SetRealTime;<br> &nbsp; &nbsp; &nbsp;property Speed: LongWord read GetSpeed write SetSpeed;<br> &nbsp; &nbsp; &nbsp;property Volume: LongWord read GetVolume write SetVolume;<br> &nbsp; published<br> &nbsp; &nbsp; &nbsp;property Filename: WideString read FFile write FFile;<br> &nbsp; &nbsp; &nbsp;property Output: TSpeechOutput read FOutput write FOutput;<br> &nbsp; &nbsp; &nbsp;property Text: TStrings read FText write SetText;<br> &nbsp; &nbsp; &nbsp;property Version: String read FVersion write DummyS;<br><br> &nbsp; &nbsp; &nbsp;property OnStart: TNotifyEvent read FOnStart write FOnStart;<br> &nbsp; &nbsp; &nbsp;property OnStop: TNotifyEvent read FOnStop write FOnStop;<br> &nbsp; &nbsp; &nbsp;property OnVisual: TMSVisualEvent read FOnVisual write FOnVisual;<br> &nbsp; end;<br><br>implementation<br><br>{ TMSpeech: implementation of DirectTextToSpeech}<br><br>{ construction/deconstruction }<br><br>constructor TMSpeech.Create(AOwner: TComponent);<br>begin<br> &nbsp; inherited;<br><br> &nbsp; FEngines := TStringList.Create;<br> &nbsp; FText := TStringList.Create;<br><br> &nbsp; FKey := 0;<br> &nbsp; FPos := 0;<br> &nbsp; FOutput := soGeneral;<br> &nbsp; FPaused := False;<br> &nbsp; FVersion := 'Monster Speech 1.1.0';<br><br> &nbsp; Init;<br>end;<br><br>destructor TMSpeech.Destroy;<br>begin<br> &nbsp; FInit := False;<br> &nbsp; FEngines.Free;<br> &nbsp; FText.Free;<br><br> &nbsp; if Assigned(PModeInfo) then Dispose(PModeInfo);<br><br> &nbsp; inherited;<br>end;<br><br>{ Methods }<br><br>procedure TMSpeech.Init;<br>var ModeInfo: TTSModeInfo;<br> &nbsp; &nbsp;EngineCount: Integer;<br>begin<br> &nbsp; FInit := True;<br> &nbsp; FEngineStarted := False;<br> &nbsp; try<br> &nbsp; &nbsp; &nbsp;{ Enumerate engines }<br> &nbsp; &nbsp; &nbsp;OleCheck(CoCreateInstance(CLSID_TTSEnumerator, Nil, CLSCTX_ALL, IID_ITTSEnum, FITTSEnum));<br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSEnum.Reset);<br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSEnum.Next(1, ModeInfo, @EngineCount));<br><br> &nbsp; &nbsp; &nbsp;while EngineCount &gt; 0 do<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; FEngines.Add(String(ModeInfo.szModeName));<br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(FITTSEnum.Next(1, ModeInfo, @EngineCount));<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; except<br> &nbsp; &nbsp; &nbsp;FInit := False;<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.InitAudio;<br>begin<br> &nbsp; case Output of<br> &nbsp; &nbsp; &nbsp;soFile:<br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(CoCreateInstance(CLSID_AudioDestFile, nil, CLSCTX_ALL,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IID_IAudioFile, FIAF));<br> &nbsp; &nbsp; &nbsp;soGeneral:<br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(CoCreateInstance(CLSID_MMAudioDest, nil, CLSCTX_ALL,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IID_IAudioMultiMediaDevice, FIAMD));<br> &nbsp; end;<br>end;<br><br>function TMSpeech.GetAudioDevice;<br>begin<br> &nbsp; case Output of<br> &nbsp; &nbsp; &nbsp;soFile:<br> &nbsp; &nbsp; &nbsp; &nbsp; Result := FIAF;<br> &nbsp; &nbsp; &nbsp;soGeneral:<br> &nbsp; &nbsp; &nbsp; &nbsp; Result := FIAMD;<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.FlushFile;<br>begin<br> &nbsp; if FOutput = soFile then FIAF.Flush; // close file<br>end;<br><br>procedure TMSpeech.Inject;<br>begin<br> &nbsp; FITTSCentral.Inject(PChar(Command));<br>end;<br><br>procedure TMSpeech.BeforeSelectEngine;<br>begin<br> &nbsp; { Check if audio device is available }<br> &nbsp; InitAudio;<br><br> &nbsp; { Unregister old notify interface }<br> &nbsp; if FKey &gt; 0 then<br> &nbsp; begin<br> &nbsp; &nbsp; &nbsp;FITTSCentral.UnRegister(FKey);<br> &nbsp; &nbsp; &nbsp;FKey := 0;<br> &nbsp; end;<br><br> &nbsp; { Create notify interfaces }<br> &nbsp; FTTSBufNotifySink := TTSBufNotifySink.Create(Self);<br> &nbsp; FTTSNotifySink := TTSNotifySink.Create(Self);<br>end;<br><br>procedure TMSpeech.SelectEngine(EngineName: String);<br>var Index, EngineCount: Integer;<br> &nbsp; &nbsp;ModeInfo: TTSModeInfo;<br>begin<br> &nbsp; if not FInit then<br> &nbsp; &nbsp; &nbsp;raise EMSpeechException.Create('msgSENotInited');<br><br> &nbsp; Index := Engines.IndexOf(EngineName);<br> &nbsp; if Index &lt; 0 then<br> &nbsp; &nbsp; &nbsp;raise EMSpeechException.Create(msgSENotFound);<br><br> &nbsp; { Select Engine }<br> &nbsp; FEngineStarted := True;<br> &nbsp; try<br> &nbsp; &nbsp; &nbsp;BeforeSelectEngine;<br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSEnum.Reset);<br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSEnum.Skip(Index));<br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSEnum.Next(1, ModeInfo, @EngineCount));<br><br> &nbsp; &nbsp; &nbsp;if Assigned(PModeInfo) then Dispose(PModeInfo);<br> &nbsp; &nbsp; &nbsp;New(PModeInfo);<br> &nbsp; &nbsp; &nbsp;PModeInfo^ := ModeInfo;<br><br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSEnum.Select(PModeInfo^.gModeID,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FITTSCentral, GetAudioDevice));<br><br> &nbsp; &nbsp; &nbsp;PostSelectEngine;<br> &nbsp; &nbsp; &nbsp;PostSelectEngine2(ModeInfo);<br> &nbsp; except<br> &nbsp; &nbsp; &nbsp;FEngineStarted := False;<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.SelectEngine(EngineMode: TTSModeInfo);<br>var FITTSFind: ITTSFind;<br> &nbsp; &nbsp;ModeInfo: TTSModeInfo;<br>begin<br> &nbsp; if not FInit then<br> &nbsp; &nbsp; &nbsp;raise EMSpeechException.Create(msgSENotInited);<br><br> &nbsp; { Find and Select Engine }<br> &nbsp; FEngineStarted := True;<br> &nbsp; try<br> &nbsp; &nbsp; &nbsp;try<br> &nbsp; &nbsp; &nbsp; &nbsp; BeforeSelectEngine;<br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(CoCreateInstance(CLSID_TTSEnumerator, nil, CLSCTX_ALL,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IID_ITTSFind, FITTSFind));<br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(FITTSFind.QueryInterface(IID_ITTSEnum, FITTSEnum));<br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(FITTSFind.Find(EngineMode, nil, ModeInfo));<br><br> &nbsp; &nbsp; &nbsp; &nbsp; if Assigned(PModeInfo) then Dispose(PModeInfo);<br> &nbsp; &nbsp; &nbsp; &nbsp; New(PModeInfo);<br> &nbsp; &nbsp; &nbsp; &nbsp; PModeInfo^ := ModeInfo;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; OleCheck(FITTSFind.Select(PModeInfo^.gModeID,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FITTSCentral, GetAudioDevice));<br><br> &nbsp; &nbsp; &nbsp; &nbsp; PostSelectEngine;<br> &nbsp; &nbsp; &nbsp; &nbsp; PostSelectEngine2(ModeInfo);<br> &nbsp; &nbsp; &nbsp;except<br> &nbsp; &nbsp; &nbsp; &nbsp; FEngineStarted := False;<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; finally<br> &nbsp; &nbsp; &nbsp;FITTSFind._Release;<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.PostSelectEngine;<br>begin<br> &nbsp; OleCheck(FITTSCentral.QueryInterface(IID_ITTSAttributes, FITTSAttributes));<br> &nbsp; OleCheck(FITTSCentral.QueryInterface(IID_ITTSDialogs, FITTSDialogs));<br> &nbsp; OleCheck(FITTSCentral.Register(Pointer(FTTSNotifySink),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;IID_ITTSNotifySink, FKey));<br>end;<br><br>procedure TMSpeech.PostSelectEngine2;<br>var CurrentPitch: Word;<br> &nbsp; &nbsp;CurrentRealTime, CurrentSpeed: LongWord;<br>begin<br> &nbsp; { Retrieve Engine Information }<br> &nbsp; FInfo.Language := StrPas(ModeInfo.Language.szDialect);<br> &nbsp; with FInfo, ModeInfo do<br> &nbsp; begin<br> &nbsp; &nbsp; &nbsp;Name := StrPas(szModeName);<br> &nbsp; &nbsp; &nbsp;Manufacturer := StrPas(szMfgName);<br> &nbsp; &nbsp; &nbsp;Product := StrPas(szProductName);<br> &nbsp; &nbsp; &nbsp;ModeID := GUIDToString(gModeID);<br> &nbsp; &nbsp; &nbsp;EngineID := GUIDToString(gEngineID);<br> &nbsp; &nbsp; &nbsp;Speaker := StrPas(szSpeaker);<br> &nbsp; &nbsp; &nbsp;Style := StrPas(szStyle);<br><br> &nbsp; &nbsp; &nbsp;case wGender of<br> &nbsp; &nbsp; &nbsp; &nbsp; 0: Gender := 'NEUTRAL';<br> &nbsp; &nbsp; &nbsp; &nbsp; 1: Gender := 'FEMALE';<br> &nbsp; &nbsp; &nbsp; &nbsp; 2: Gender := 'MALE';<br> &nbsp; &nbsp; &nbsp;end;<br><br> &nbsp; &nbsp; &nbsp;Age := wAge;<br> &nbsp; &nbsp; &nbsp;Features := dwFeatures;<br> &nbsp; &nbsp; &nbsp;Interfaces := dwInterfaces;<br><br> &nbsp; &nbsp; &nbsp;with FITTSAttributes do<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; PitchGet(CurrentPitch);<br> &nbsp; &nbsp; &nbsp; &nbsp; PitchSet(TTSATTR_MAXPITCH);<br> &nbsp; &nbsp; &nbsp; &nbsp; PitchGet(MaxPitch);<br> &nbsp; &nbsp; &nbsp; &nbsp; PitchSet(TTSATTR_MINPITCH);<br> &nbsp; &nbsp; &nbsp; &nbsp; PitchGet(MinPitch);<br> &nbsp; &nbsp; &nbsp; &nbsp; PitchSet(CurrentPitch);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; RealTimeGet(CurrentRealTime);<br> &nbsp; &nbsp; &nbsp; &nbsp; RealTimeSet(TTSATTR_MAXREALTIME);<br> &nbsp; &nbsp; &nbsp; &nbsp; RealTimeGet(MaxRealTime);<br> &nbsp; &nbsp; &nbsp; &nbsp; RealTimeSet(TTSATTR_MINREALTIME);<br> &nbsp; &nbsp; &nbsp; &nbsp; RealTimeGet(MinRealTime);<br> &nbsp; &nbsp; &nbsp; &nbsp; RealTimeSet(CurrentRealTime);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; SpeedGet(CurrentSpeed);<br> &nbsp; &nbsp; &nbsp; &nbsp; SpeedSet(TTSATTR_MAXSPEED);<br> &nbsp; &nbsp; &nbsp; &nbsp; SpeedGet(MaxSpeed);<br> &nbsp; &nbsp; &nbsp; &nbsp; SpeedSet(TTSATTR_MINSPEED);<br> &nbsp; &nbsp; &nbsp; &nbsp; SpeedGet(MinSpeed);<br> &nbsp; &nbsp; &nbsp; &nbsp; SpeedSet(CurrentSpeed);<br><br> &nbsp; &nbsp; &nbsp; &nbsp; { According to MS's help file }<br> &nbsp; &nbsp; &nbsp; &nbsp; MaxVolume := 100;<br> &nbsp; &nbsp; &nbsp; &nbsp; MinVolume := 0;<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.Pause;<br>begin<br> &nbsp; OleCheck(FITTSCentral.AudioPause);<br> &nbsp; FPaused := True;<br>end;<br><br>procedure TMSpeech.Resume;<br>begin<br> &nbsp; OleCheck(FITTSCentral.AudioResume);<br> &nbsp; FPaused := False;<br>end;<br><br>procedure TMSpeech.Show;<br>begin<br> &nbsp; case DialogType of<br> &nbsp; &nbsp; &nbsp;sdAbout: OleCheck(FITTSDialogs.AboutDlg(ParentWnd, nil));<br> &nbsp; &nbsp; &nbsp;sdGeneral: OleCheck(FITTSDialogs.GeneralDlg(ParentWnd, nil));<br> &nbsp; &nbsp; &nbsp;sdLexicon: OleCheck(FITTSDialogs.LexiconDlg(ParentWnd, nil));<br> &nbsp; &nbsp; &nbsp;sdTranslate: OleCheck(FITTSDialogs.TranslateDlg(ParentWnd, nil));<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.Speak;<br>var SData : TSData;<br>begin<br> &nbsp; if not FInit then<br> &nbsp; &nbsp; &nbsp;raise EMSpeechException.Create(msgSENotInited);<br><br> &nbsp; if not FEngineStarted then<br> &nbsp; &nbsp; &nbsp;raise EMSpeechException.Create(msgSENotStarted);<br><br> &nbsp; FPaused := False;<br>// OleCheck(FITTSCentral.AudioReset);<br><br> &nbsp; try<br> &nbsp; &nbsp; &nbsp;if FOutput = soFile then<br> &nbsp; &nbsp; &nbsp; &nbsp; if FIAF.DoSet(PWideChar(Filename), 1) &lt; 0 then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;raise EMSpeechException.Create('msgCannotOpenFile');<br><br> &nbsp; &nbsp; &nbsp;SData.dwSize := Length(FText.Text) + 1;<br> &nbsp; &nbsp; &nbsp;SData.pData := PChar(FText.Text);<br> &nbsp; &nbsp; &nbsp;OleCheck(FITTSCentral.TextData (CHARSET_TEXT, 0,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SData, Pointer(FTTSBufNotifySink), IID_ITTSBufNotifySink));<br> &nbsp; except<br> &nbsp; end;<br>end;<br><br>procedure TMSpeech.Stop;<br>begin<br> &nbsp; FPaused := False;<br> &nbsp; OleCheck(FITTSCentral.AudioReset);<br>end;<br><br>function TMSpeech.GetEngineInfo;<br>var Index, EngineCount: Integer;<br> &nbsp; &nbsp;ModeInfo: TTSModeInfo;<br>begin<br> &nbsp; Result := False;<br><br> &nbsp; if not FInit then Exit;<br> &nbsp; Index := Engines.IndexOf(EngineName);<br> &nbsp; if Index &lt; 0 then Exit;<br><br> &nbsp; if FITTSEnum.Reset &lt; 0 then Exit;<br> &nbsp; if FITTSEnum.Skip(Index) &lt; 0 then Exit;<br> &nbsp; if FITTSEnum.Next(1, ModeInfo, @EngineCount) &lt; 0 then Exit;<br><br> &nbsp; { Retrieve Engine Information }<br> &nbsp; FillChar(Result, Sizeof(Result), 0);<br> &nbsp; Info.Language := StrPas(ModeInfo.Language.szDialect);<br> &nbsp; with Info, ModeInfo do<br> &nbsp; begin<br> &nbsp; &nbsp; &nbsp;Name := StrPas(szModeName);<br> &nbsp; &nbsp; &nbsp;Manufacturer := StrPas(szMfgName);<br> &nbsp; &nbsp; &nbsp;Product := StrPas(szProductName);<br> &nbsp; &nbsp; &nbsp;ModeID := GUIDToString(gModeID);<br> &nbsp; &nbsp; &nbsp;EngineID := GUIDToString(gEngineID);<br> &nbsp; &nbsp; &nbsp;Speaker := StrPas(szSpeaker);<br> &nbsp; &nbsp; &nbsp;Style := StrPas(szStyle);<br><br> &nbsp; &nbsp; &nbsp;case wGender of<br> &nbsp; &nbsp; &nbsp; &nbsp; 0: Gender := 'NEUTRAL';<br> &nbsp; &nbsp; &nbsp; &nbsp; 1: Gender := 'FEMALE';<br> &nbsp; &nbsp; &nbsp; &nbsp; 2: Gender := 'MALE';<br> &nbsp; &nbsp; &nbsp;end;<br><br> &nbsp; &nbsp; &nbsp;Age := wAge;<br> &nbsp; &nbsp; &nbsp;Features := dwFeatures;<br> &nbsp; &nbsp; &nbsp;Interfaces := dwInterfaces;<br><br> &nbsp; &nbsp; &nbsp;MaxVolume := 100;<br> &nbsp; end;<br> &nbsp; Result := True;<br>end;<br><br>{ Setting/Getting properties }<br><br>{ Undocumented property, for advanced user only }<br>function TMSpeech.GetInterface;<br>begin<br> &nbsp; case Index of<br> &nbsp; &nbsp; &nbsp;0: Result := GetAudioDevice;<br> &nbsp; &nbsp; &nbsp;1: Result := FITTSCentral;<br> &nbsp; &nbsp; &nbsp;2: Result := FITTSAttributes;<br> &nbsp; &nbsp; &nbsp;3: Result := FITTSDialogs;<br> &nbsp; end;<br>end;<br><br>function TMSpeech.GetPitch;<br>begin<br> &nbsp; FITTSAttributes.PitchGet(Result);<br>end;<br><br>procedure TMSpeech.SetPitch;<br>begin<br> &nbsp; FITTSCentral.Inject(PChar('/Pit=' + IntToStr(Value) + '/'));<br>// FITTSAttributes.PitchSet(Value);<br>end;<br><br>function TMSpeech.GetRealTime;<br>begin<br> &nbsp; FITTSAttributes.RealTimeGet(Result);<br>end;<br><br>procedure TMSpeech.SetRealTime;<br>begin<br> &nbsp; FITTSAttributes.RealTimeSet(Value);<br>end;<br><br>function TMSpeech.GetSpeed;<br>begin<br> &nbsp; FITTSAttributes.SpeedGet(Result);<br>end;<br><br><br>procedure TMSpeech.SetSpeed;<br>begin<br> &nbsp; FITTSCentral.Inject(PChar('/Spd=' + IntToStr(Value) + '/'));<br>// FITTSAttributes.SpeedSet(Value);<br>end;<br><br>{$ifdef MANUAL_SET_AND_GET_VOLUME}<br>function TMSpeech.GetVolume;<br>begin<br> &nbsp; FITTSAttributes.VolumeGet(Result);<br>end;<br><br>procedure TMSpeech.SetVolume;<br>begin<br> &nbsp; FITTSCentral.Inject(PChar('/Vol=' + IntToStr(Volume) + '/'));<br>end;<br>{$else}<br>function TMSpeech.GetVolume;<br>var CurrentVolume: LongWord;<br>begin<br> &nbsp; FITTSAttributes.VolumeGet(CurrentVolume);<br> &nbsp; Result := LoWord(CurrentVolume) * 100 div 65535;<br>end;<br><br>procedure TMSpeech.SetVolume;<br>var TempVolume: LongWord;<br>begin<br> &nbsp; TempVolume := 65535 * Value div 100;<br> &nbsp; TempVolume := MakeWParam(TempVolume, TempVolume);<br> &nbsp; FITTSCentral.Inject(PChar('/Vol=' + IntToStr(TempVolume) + '/'));<br>// OleCheck(FITTSAttributes.VolumeSet(TempVolume));<br>end;<br>{$endif}<br><br>procedure TMSpeech.SetText;<br>begin<br> &nbsp; FText.Assign(Value);<br>end;<br><br>{ TTSNotifySink }<br><br>constructor TTSNotifySink.Create;<br>begin<br> &nbsp; FOwner := AOwner;<br>end;<br><br>function TTSNotifySink.AttribChanged;<br>begin<br> &nbsp; Result := 0;<br>end;<br><br>function TTSNotifySink.AudioStart;<br>begin<br> &nbsp; if Assigned(FOwner.FOnStart) then FOwner.FOnStart(Self);<br> &nbsp; Result := 0;<br>end;<br><br>function TTSNotifySink.AudioStop;<br>begin<br> &nbsp; FOwner.FlushFile;<br> &nbsp; if Assigned(FOwner.FOnStop) then FOwner.FOnStop(Self);<br> &nbsp; Result := 0;<br>end;<br><br>function TTSNotifySink.Visual;<br>begin<br> &nbsp; if Assigned(FOwner.FOnVisual) then FOwner.FOnVisual(Self, dwHints, apTTSMouth);<br> &nbsp; Result := 0;<br>end;<br><br>{ TTSBufNotifySink }<br><br>constructor TTSBufNotifySink.Create;<br>begin<br> &nbsp; FOwner := AOwner;<br>end;<br><br>function TTSBufNotifySink.BookMark;<br>begin<br> &nbsp; Result := 0;<br>end;<br><br>function TTSBufNotifySink.TextDataDone;<br>begin<br> &nbsp; Result := 0;<br>end;<br><br>function TTSBufNotifySink.TextDataStarted;<br>begin<br> &nbsp; Result := 0;<br>end;<br><br>function TTSBufNotifySink.WordPosition;<br>begin<br> &nbsp; FOwner.FPos := dwByteOffset;<br> &nbsp; Result := 0;<br>end;<br><br>end. <br> <br>009 (2000-12-31 12:28:00) &nbsp;<br>go on <br> <br>zyuz (2001-01-16 16:47:00) &nbsp;<br>我怎么好象没有看明白。。。。 <br> <br>zyy04 (2001-01-16 18:02:00) &nbsp;<br>说清楚你用的是Speech 4,还是Speech 5? <br> <br>悲酥清风 (2001-04-02 13:15:00) &nbsp;<br>009:请自己提前或结束你的帖子,谢谢合作。 <br> <br>wjiachun (2001-06-17 20:17:00) &nbsp;<br>接受答案了. <br> <br><br>CJ的回答最终被接受。
 
网上有女声库!也有破解。不过,个人觉得,效果不好。
 
我用的是 Speech 5 想用中文女生
 
后退
顶部