delphi - How to Create a Simple Dictation Pad in Delphi2009+Vista -
the code not complecated..
private { private declarations } spsharedrecocontext1 : tspsharedrecocontext; fmygrammar : ispeechrecogrammar; procedure spsharedrecocontext1recognition(asender: tobject; streamnumber: integer; streamposition: olevariant; recognitiontype: speechrecognitiontype; const result: ispeechrecoresult); procedure spsharedrecocontext1hypothesis(asender: tobject; streamnumber: integer; streamposition: olevariant; const result: ispeechrecoresult);
procedure tform1.formcreate(sender: tobject); begin spsharedrecocontext1 := tspsharedrecocontext.create(self); spsharedrecocontext1.onhypothesis := spsharedrecocontext1hypothesis; spsharedrecocontext1.onrecognition :=spsharedrecocontext1recognition; fmygrammar := spsharedrecocontext1.creategrammar(0); fmygrammar.dictationsetstate(sgdsactive); end; procedure tform1.spsharedrecocontext1recognition(asender: tobject; streamnumber: integer; streamposition: olevariant; recognitiontype: speechrecognitiontype; const result: ispeechrecoresult); begin memo1.text := result.phraseinfo.gettext(0,-1,true); end; procedure tform1.spsharedrecocontext1hypothesis(asender: tobject; streamnumber: integer; streamposition: olevariant; const result: ispeechrecoresult); begin memo1.text := result.phraseinfo.gettext(0,-1,true); end;
my problem, vista-os voice command intercept on program. if "start", instead of writing start on memo1 press start menu on desktop. or ever command start cancel edit delete select etc. please help..... sorry english
you need use in-process recognizer, rather shared recognizer. @ spinprocrecocontext object.
in particular, need set audioinput property of recognizer, inproc recognizer knows audio from.
a worked example simple dictation part of windows 7 or windows vista sdk - after install it, it's in $(windowssdkdir)\samples\winui\speech\simpledictation.
the samples in c++, should able use launching point.
Comments
Post a Comment