00001 #ifndef _SPEECHTRANSFORMATION_H
00002 #define _SPEECHTRANSFORMATION_H
00003
00004
00005
00006 #include <common/Transformation.h>
00007 #include <common/File.h>
00008 #include <input/SpeechVoice.h>
00009 #include <core/Event.h>
00010 #include <string>
00011
00012
00013
00014 namespace ot {
00015
00016
00017
00018
00019
00020
00021
00022
00023 class SpeechTransformation : public Transformation
00024 {
00025 friend class CommonNodeFactory;
00026
00027 public:
00028 enum Command { RESET = 0, UP, DOWN, LEFT, RIGHT, FORWARD, BACKWARD, MOVE_UP, MOVE_DOWN, MOVE_LEFT, MOVE_RIGHT, MOVE_FORWARD, MOVE_BACKWARD, ROTATE_UP, ROTATE_DOWN, ROTATE_UP_FAST, ROTATE_DOWN_FAST, AXIAL, SAGITTAL, CORONAL, RESTORE_ONE, RESTORE_TWO, RESTORE_THREE, RESTORE_FOUR, RESTORE_FIVE, UNDOABLE_CMDS_FLAG,
00029 SAVE_ONE, SAVE_TWO, SAVE_THREE, SAVE_FOUR, SAVE_FIVE, SAVE_STATE, UNDO, REDO, SCALE_UP, SCALE_DOWN, SET_ROTATION_AXIS_TO_AXIAL_CORONAL, SET_ROTATION_AXIS_TO_SAGITTAL_CORONAL, SET_ROTATION_AXIS_TO_AXIAL_SAGITTAL, PERFORMABLE_CMDS_FLAG,
00030 LISTEN, QUIT, YES, NO, LAST_CMD_FLAG };
00031 enum RecoEvent { IDLE = -1, WAIT_FOR_COMMAND = 0, WAIT_FOR_CONFIRMATION };
00032 enum RotationAxis { INVALID = -1, AXIAL_CORONAL = 0, SAGITTAL_CORONAL, AXIAL_SAGITTAL };
00033
00034 SpeechTransformation(const std::string logFile_ = "", const bool useListeningMode = false, const bool useConfirmation_ = true, const std::string voice_ = "Mary");
00035 ~SpeechTransformation();
00036
00037 protected:
00038 virtual Event* transformEvent(Event* event);
00039 virtual bool performCommand(const int commandId, bool &explained);
00040 void reset(Event &event);
00041 bool undo();
00042 bool redo();
00043 bool rotate(bool moveUp, bool fast);
00044 std::string getCommandName(int commandId);
00045
00046 int commandToBeConfirmed;
00047 int undoCommand;
00048 int redoCommand;
00049 int logCount;
00050 bool useConfirmation;
00051 bool useListeningMode;
00052 bool savedEventAvailable[5];
00053 double scale;
00054 double startTime;
00055 double lastCmdTime;
00056 double minDelay;
00057 double maxDelay;
00058 CSpeechVoice tts;
00059 RecoEvent recoEvent;
00060 RotationAxis rotationAxis;
00061 File* logFile;
00062 Event undoEvent;
00063 Event redoEvent;
00064 Event savedEvents[5];
00065 };
00066 }
00067
00068
00069 #endif