00001 #ifndef _SPEECHCONTROLSOURCE_HEADER 00002 #define _SPEECHCONTROLSOURCE_HEADER 00003 00004 00005 #include "SpeechControlModule.h" 00006 #include "CommandFactory.h" 00007 #include "CommandStack.h" 00008 #include "TtsString.h" 00009 #include <input/SpeechSource.h> 00010 00011 00012 namespace ot 00013 { 00014 00015 00016 // class *SpeechControlSource* 00017 // ******************************************************************************************* 00018 // - sub class of SpeechSource 00019 // - allows continuous movements 00020 00021 00022 class SpeechControlSource : public SpeechSource 00023 { 00024 friend class SpeechControlModule; 00025 00026 public: 00027 bool push(); 00028 void speak(const char *sentence) { m_SpeechModule->Speak(sentence); }; 00029 void setListening(bool lis) { listening = lis; }; 00030 void setMoving(bool mov) { moving = mov; }; 00031 void setEvent(Event &newEvent) { event = newEvent; }; 00032 void setSavedEvent(int i, Event& s) { savedEvents[i] = s; savedEventAvailable[i] = true; }; 00033 bool isMoving() { return moving; }; 00034 bool isWasMoving() { return wasMoving; }; 00035 bool isSavedEventAvailable(int i) { return savedEventAvailable[i]; }; 00036 double getFeedbackAvoidanceTime(double syl) { return syl * 500.0; }; 00037 Event& getEvent() { return event; }; 00038 Event& getSavedEvent(int i) { return savedEvents[i]; }; 00039 CommandStack& getCmdStack() { return *cmdStack; }; 00040 Command* getLastCmd() { return (cmdStack->size() == 0) ? NULL : cmdStack->front(); }; 00041 00042 protected: 00043 SpeechControlSource(SpeechControlModule *speechControlModule_, SpeechSetBase *speechSet_); 00044 ~SpeechControlSource(); 00045 00046 bool moving; 00047 bool wasMoving; 00048 bool listening; 00049 bool savedEventAvailable[5]; 00050 Event savedEvents[5]; 00051 double listeningStartTime; 00052 double lastSpeakTime; 00053 double feedbackAvoidanceTime; 00054 CommandStack* cmdStack; 00055 }; 00056 00057 00058 } // namespace ot 00059 00060 00061 #endif
1.4.6