Beispiel #1
0
        public Form1()
        {
            InitializeComponent();

            LoadProfile("Profile1");
            InitGUI();

            kinectStick = null;
            compiledProfile = null;
        }
        public KinectStickEngine(CompiledProfile profile)
        {
            actualNode = null;
            instructionQueue = new List<CompiledSpeechPhrase>();
            joy = new VJoyWrapper();
            inputSimulator = new InputSimulator();
            this.profile = profile;

            ready = InitKinect() && LoadSpeechRecognitionEngine();
        }
Beispiel #3
0
        private void compilarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (saved)
            {
                if (compiledProfile == null)
                {
                    compiledProfile = ProfileCompiler.Compile(profile);

                    if (compiledProfile != null)
                    {
                        kinectStick = new KinectStickEngine(compiledProfile);

                        kinectStick.RecognizedInstruction += OnRecognizedInstruction;
                        kinectStick.RejectedInstruction += OnRejectedInstruction;
                        kinectStick.RecognizedPhrase += OnRecognizedPhrase;
                    }
                    else
                        MessageBox.Show("Error al compilar el perfil", "KinectStick - Compilación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    compiledProfile = ProfileCompiler.Compile(profile);

                    if (compiledProfile != null)
                        kinectStick.SetProfile(compiledProfile);
                    else
                        MessageBox.Show("Error al compilar el perfil", "KinectStick - Compilación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if(!kinectStick.Ready)
                    MessageBox.Show("Error al configurar el engine: Error de conexión con Kinect o fallo en la carga del motor de reconocimiento de voz", "KinectStick - Compilación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                else
                    MessageBox.Show("Perfil compilado correctamente", "KinectStick - Compilación", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
                compilarToolStripMenuItem.Enabled = false;
        }
 public void SetProfile(CompiledProfile profile)
 {
     this.profile = profile;
     ResetInstructionPipeline();
     if (kinect != null)
         ready = LoadSpeechRecognitionEngine();
     else
         ready = false;
 }