/// <summary> /// Initializes the config object with subscription key and region /// Initializes the recognizer object with a TranslationRecognizer /// Subscribes the recognizer to recognition Event Handlers /// If recognition is running, starts a thread which stops the recognition /// </summary> private void CreateRecognizer() { this.config = SpeechTranslationConfig.FromSubscription(SubscriptionKey, Region); this.config.SpeechRecognitionLanguage = FromLanguage; this.config.VoiceName = voice; ToLanguages.ForEach(l => this.config.AddTargetLanguage(l)); this.recognizer = new TranslationRecognizer(this.config); this.recognizer.Recognizing += this.OnRecognizingEventHandler; this.recognizer.Recognized += this.OnRecognizedEventHandler; this.recognizer.Synthesizing += this.OnSynthesizingEventHandler; this.recognizer.Canceled += this.OnCanceledEventHandler; }
private void CreateRecognizer() { //Microsoft.CognitiveServices.Speech.Internal.carbon_csharp a = new car(); this.config = SpeechTranslationConfig.FromSubscription(SubscriptionKey, Region); this.config.SpeechRecognitionLanguage = FromLanguage; this.config.VoiceName = voice; ToLanguages.ForEach(l => this.config.AddTargetLanguage(l)); this.recognizer = new TranslationRecognizer(this.config); this.recognizer.Recognizing += this.OnRecognizingEventHandler; this.recognizer.Recognized += this.OnRecognizedEventHandler; this.recognizer.Synthesizing += this.OnSynthesizingEventHandler; this.recognizer.Canceled += this.OnCanceledEventHandler; }