private void ThreadFunc()
{
if(myPipe==null){return;}
else if(!initiated){return;}
while(myPipe.AcquireFrame(true) && keepLooping){
if(myPipe.QueryVoiceRecognized(out voice)){//the out keyword causes the the function to change the original voice var
lock(lockObj){ //lockObj esists only for this purpose, making this critical section
dictated = "Voice Heard! Label: "+voice.label+", text: "+voice.dictation+", confidence: "+voice.confidence+"\n";
if(debugging)Debug.Log(dictated);//the label is the index in the commands array of the heard command.
//the dictation holds the string value at that position in the array.
//confidence is for reference,
if(voice.label>-1 && voice.label<10)numbers[voice.label] = true;
if(voice.label >9 && voice.label < 18)options[voice.label-10] = true;
if(voice.label == 18)restarter = true;
}
}
myPipe.ReleaseFrame();//must release the frame or you will never get any responses.
}
}