Exemple #1
0
        private void button_ySend_Click(object sender, RoutedEventArgs e)
        {
            string channel = comboBox_yChannel.SelectionBoxItem.ToString();
            string control = comboBox_yMidiSignal.SelectionBoxItem.ToString();

            kinect2Midi midi1 = new kinect2Midi();

            midi1.sendY(channel, control);
            midi1.Dispose();
        }
        public MainWindow()
        {
            InitializeComponent();
            midi1 = new kinect2Midi();
            try
            {
                if (KinectSensor.KinectSensors.Count == 0)
                {
                    isNotConnected = true;
                    throw new Exception("Kinectが接続されていません");
                }

                // Kinectインスタンスを取得する
                kinect = KinectSensor.KinectSensors[0];

                //Seated modeの設定を反映する
                if (kinectTestWPF1.App.isSeated == true)
                {
                    kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
                }

                // すべてのフレーム更新通知をもらう
                kinect.AllFramesReady += new EventHandler <AllFramesReadyEventArgs>(kinect_AllFramesReady);

                // Color,Depth,Skeletonを有効にする
                kinect.ColorStream.Enable();
                kinect.DepthStream.Enable();
                kinect.SkeletonStream.Enable();

                // Kinectの動作を開始する
                kinect.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //Close();
            }
        }