System.Speech.Internal.SapiInterop.IspRecognizer:SetRecoState(System.Speech.Internal…SapiInterop.SPRECOSTATE)
using System;
using System.Text;
using UnityEngine;
using System.Speech;
using System.Speech.Recognition;
public class SoundSC2 : MonoBehaviour
{
private SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
Choices commands = new Choices();
void Start()
{
commands.Add (new string[ ]{“mass velocity”,“cube velocity”,“sphere velocity”," move"});
GrammarBuilder gb = new GrammarBuilder ();
gb.Append (commands);
Grammar g = new Grammar (gb);
sre.LoadGrammarAsync (g);
sre.SetInputToDefaultAudioDevice ();
sre.RecognizeAsync (RecognizeMode.Multiple);
sre.SpeechRecognized += processCommand;
}
void processCommand(object sender,SpeechRecognizedEventArgs e)
{
string s = e.Result.Text;
if (s.Equals (“mass velocity”)) {
print (“mv”);
}
else if (s.Equals (“cube velocity”)) {
print (“cv”);
}
}
}