Пример #1
0
 public virtual void Speak(string message, bool async)
 {
     tts.SayTextRequest streq = new tts.SayTextRequest();
     streq.SpeechText = message;
     if (async)
     {
         ttsPort.SayText(streq);
     }
     else
     {
         AutoResetEvent aevent = new AutoResetEvent(false);
         Arbiter.Activate(DssEnvironment.TaskQueue,
                          Arbiter.Choice(ttsPort.SayText(streq),
                                         delegate(DefaultUpdateResponseType state)
         {
             aevent.Set();
         },
                                         delegate(Fault f)
         {
             aevent.Set();
         }
                                         ));
         aevent.WaitOne(1000, false);
     }
 }
Пример #2
0
            void OnSetSrgsGrammarFileSuccess(dssp.DefaultUpdateResponseType response)
            {
                texttospeech.SayTextRequest request = new texttospeech.SayTextRequest();
                request.SpeechText = @"I successfully loaded the speech grammar. What can I do for you now?";
                TexttoSpeechTTSPort.SayText(request);

                Decrement();
            }
Пример #3
0
            void OnSetSrgsGrammarFileFault(soap.Fault response)
            {
                texttospeech.SayTextRequest request = new texttospeech.SayTextRequest();
                request.SpeechText = @"Could not load the grammar file. The error is as follows: " + response.Reason[response.Reason.Length - 1].Value;
                TexttoSpeechTTSPort.SayText(request);

                Decrement();
            }
Пример #4
0
            ///////////////////////////////////////////////////////////////////
            // [(__use__3.snippet.snippet.noop - __use__3.snippet.snippet.expr - __use__3.snippet.snippet.join)] - __use__3.snippet.call - __use__3.snippet.call.iftype
            ///////////////////////////////////////////////////////////////////

            void _mergeAlphaHandler(object message)
            {
                texttospeech.SayTextRequest request = new texttospeech.SayTextRequest();
                request.SpeechText = @"I did not understand you.";
                TexttoSpeechTTSPort.SayText(request);

                Decrement();
            }
Пример #5
0
        void BumperNotificationHandler(contactsensor.Update updateNotification)
        {
            contactsensor.ContactSensor s = updateNotification.Body;
            if (!s.Pressed)
            {
                return;
            }

            if (!string.IsNullOrEmpty(s.Name) && s.Name.ToLowerInvariant().Contains("left"))
            {
                //say something
                speech.SayTextRequest saythis = new speech.SayTextRequest();
                saythis.SpeechText = "Turning right";
                _speechPort.SayText(saythis);

                //update state
                _state.CurrentAction = "Turning right";

                //move
                SpawnIterator <int>(-800, BackUpTurnAndMove);
            }
            else if (!string.IsNullOrEmpty(s.Name) && s.Name.ToLowerInvariant().Contains("right"))
            {
                //say something
                speech.SayTextRequest saythis = new speech.SayTextRequest();
                saythis.SpeechText = "Turning left";
                _speechPort.SayText(saythis);

                //update state
                _state.CurrentAction = "Turning left";

                //move
                SpawnIterator <int>(800, BackUpTurnAndMove);
            }
            else if (!string.IsNullOrEmpty(s.Name) && s.Name.ToLowerInvariant().Contains("stall"))
            {
                //say something
                speech.SayTextRequest saythis = new speech.SayTextRequest();
                saythis.SpeechText = "Ouch, let go.";
                _speechPort.SayText(saythis);

                //update state
                _state.CurrentAction = "Turning around";

                //move
                SpawnIterator <int>(800, BackUpTurnAndMove);
            }
        }