public static void Start(User u, SpeechStateCallbackDelegate del, Delegate networkDel) { switch (SpeechProvider) { case SpeechProviders.NativeSpeech: NativeSpeechHelper.Start(u, del, networkDel); break; case SpeechProviders.NuanceSpeech: NuanceSpeechHelper.Start(u, del, networkDel); break; } }
public static void Start(User u, SpeechToTextCallbackDelegate speechToTextDel, SpeechStateCallbackDelegate speechStateDel, Delegate networkDel) { // trace the speech request TraceHelper.AddMessage("Starting Speech"); // Start is not reentrant - make sure the caller didn't violate the contract if (speechOperationInProgress == true) { return; } // store the delegates passed in speechToTextDelegate = speechToTextDel; speechStateDelegate = speechStateDel; // initialize the connection if (InitializeSpeechKit() == false) { Cancel(networkDel); return; } // start a new thread that starts the dictation DictationStart(SKRecognizerType.SKDictationRecognizerType); }
public static void Start(User u, SpeechToTextCallbackDelegate speechToTextDel, SpeechStateCallbackDelegate speechStateDel, Delegate networkDel) { // trace the speech request TraceHelper.AddMessage("Starting Speech"); // Start is not reentrant - make sure the caller didn't violate the contract if (speechOperationInProgress == true) return; // store the delegates passed in speechToTextDelegate = speechToTextDel; speechStateDelegate = speechStateDel; // initialize the connection if (InitializeSpeechKit() == false) { Cancel(networkDel); return; } // start a new thread that starts the dictation DictationStart(SKRecognizerType.SKDictationRecognizerType); }
public static void Start(User u, SpeechStateCallbackDelegate del, Delegate networkDel) { // StartStreamed is not reentrant - make sure the caller didn't violate the contract if (speechOperationInProgress == true) return; // set the flag speechOperationInProgress = true; // store the delegates passed in speechStateDelegate = del; networkDelegate = networkDel; user = u; // initialize the microphone information and speech buffer mic.BufferDuration = TimeSpan.FromSeconds(1); int length = mic.GetSampleSizeInBytes(mic.BufferDuration); speechBuffer = new byte[length]; speechBufferList.Clear(); bufferMutexList.Clear(); numBytes = 0; // trace the speech request TraceHelper.AddMessage("Starting Speech"); // initialize frame index frameCounter = 0; // callback when the mic gathered 1 sec worth of data if (initializedBufferReadyEvent == false) { mic.BufferReady += new EventHandler<EventArgs>(MicBufferReady); initializedBufferReadyEvent = true; } // connect to the web service, and once that completes successfully, // it will invoke the NetworkInterfaceCallback delegate to indicate the network quality // this delegate will then turn around and send the appropriate encoding in the SendPost call NetworkHelper.BeginSpeech( new NetworkInformationCallbackDelegate(NetworkInformationCallback), new NetworkDelegate(NetworkCallback)); }