public MainWindow()
        {
            if ()
            {
                if ( < 80 && > 800)
                {
                    InitializeComponent();
                    MediaPlayer1.LoadedBehavior = MediaState.Manual;
                    MediaPlayer1.UnloadedBehavior = MediaState.Manual;

                    MediaPlayer2.LoadedBehavior = MediaState.Manual;
                    MediaPlayer2.UnloadedBehavior = MediaState.Manual;

                    MediaPlayer3.LoadedBehavior = MediaState.Manual;
                    MediaPlayer3.UnloadedBehavior = MediaState.Manual;

                    MediaPlayer4.LoadedBehavior = MediaState.Manual;
                    MediaPlayer4.UnloadedBehavior = MediaState.Manual;
                    afficher("C:\\noAudio.mp4");

                    this.sensorChooser = new KinectSensorChooser();
                    this.sensorChooser.KinectChanged += SensorChooserOnKinectChanged;
                    this.sensorChooser.Start();

                    connexion_kinect = Connexion.getInstance();
                    connexion_kinect.Initconnexion();

                    micro = Son.getInstance();
                    squelette = Squelette.getInstance();

                    //Thread microThread = new Thread(micro.WindowLoaded);
                    //Thread squeletteThread = new Thread(squelette.Load);

                    // Start the worker thread.

                    //TODO : Mettre en commun sensor
                    //microThread.Start(sensor);
                    //squeletteThread.Start(sensor);

                    micro.addObserver(this);
                    squelette.addObserver(this);

                    micro.Load();
                    squelette.Load();
                }
            }
            else
            {
                Thread newWindowThread = new Thread(new ThreadStart(ThreadStartingPoint));
                newWindowThread.SetApartmentState(ApartmentState.STA);
                newWindowThread.IsBackground = true;
                newWindowThread.Start();
            }
        }
Esempio n. 2
0
 public static Connexion getInstance()
 {
     if (instance != null)
     {
         return instance;
     }
     else
     {
         instance = new Connexion();
         return instance;
     }
 }
Esempio n. 3
0
        public void Load()
        {
            connexion_kinect = Connexion.getInstance();
            sensor = connexion_kinect.Sensor;

            if (sensor == null)
            {
                MessageBox.Show("Kinect non connecté");
                return;
            }

            this.drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            this.imageSource = new DrawingImage(this.drawingGroup);
            this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;
        }
Esempio n. 4
0
        /// <summary>
        /// Initialisation de la capture de la video.
        /// </summary>
        public void Load()
        {
            connexion_kinect = Connexion.getInstance();

            sensor = connexion_kinect.Sensor;

            if( sensor == null)
            {
                return;
            }

            RecognizerInfo ri = GetKinectRecognizer();

            if (null != ri)
            {

                this.speechEngine = new SpeechRecognitionEngine(ri.Id);

                try
                {
                    // Create a grammar from grammar definition XML file.

                    //TODO : Changer chemin
                    //var g = new Grammar("C:\\Users\\florian\\Desktop\\t.xml");
                    var g = new Grammar("C:\\t.xml");
                    speechEngine.LoadGrammar(g);
                    speechEngine.SpeechRecognized += SpeechRecognized;

                    speechEngine.SetInputToAudioStream(
                        sensor.AudioSource.Start(), new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null));
                    speechEngine.RecognizeAsync(RecognizeMode.Multiple);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.Data.ToString() + " - Le fichier de grammaire n'est pas trouvable");
                }
            }
        }