i am using sapi for speech recognition, i have many input audio file to process , i need process them one by one, so , firstly i set a wav file as the input audio and a grammar file ,then i wait for the recognize result , after
i get the result , i will set the next wav file as the input and another grammar file , i write a loop to do this.
the question is i can't get the result!my program looks like this
set a variable tag =false to judge if a result is produced;
for(every wav in a wav list){
initialize the sapi;
set wav as the input audio;
set a corresponding grammar file as the grammar;
while(tag==false) Thread.sleep(1000);
process the result;
}
i set tag =true in the event function SpInProcRecoContext.Recognition,so when i get a recognize result ,i can process the wav list one by one. but now my program is block at
while(tag==false) Thread.sleep(1000);
if i replace this sentence with :
MessageBox.show("anything");
when the MessageBox popup and i click the ok button, this time i get the right result!!
so i want to know how sapi thread work with the main thread, and is there any other way to replace this
MessageBox.show("anything")?