Пример #1
0
 private void use3DGestures_Unchecked(object sender, RoutedEventArgs e)
 {
     GestureTests.Config.DataPath  = @"..\..\..\data\";
     GestureTests.Config.Use3DMode = false;
     JK = new JackKnife();
     JK.InitializeFromSingleUser(GestureTests.Config.DataPath, userDirectory.Text, useOnlyTwo.IsChecked.Value);
 }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            this.KeyDown += new KeyEventHandler(MainWindow_KeyDown);
            this.KeyUp   += new KeyEventHandler(MainWindow_KeyUp);
            int waveInDevices = WaveIn.DeviceCount;

            for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++)
            {
                WaveInCapabilities deviceInfo = WaveIn.GetCapabilities(waveInDevice);
                Console.WriteLine("Device {0}: {1}, {2} channels",
                                  waveInDevice, deviceInfo.ProductName, deviceInfo.Channels);
            }

            waveIn = new WaveIn();
            waveIn.BufferMilliseconds = 47 * buffersize / 2048;
            waveIn.DeviceNumber       = 0;
            waveIn.WaveFormat         = new WaveFormat(44100, 32, 1);
            waveIn.DataAvailable     += waveIn_DataAvailable;

            try
            {
                waveIn.StartRecording();
            }
            catch (NAudio.MmException e)
            {
                Console.WriteLine(e.ToString() + "\nPlug in a microphone!");
            }

            history         = new List <List <int> >();
            inverse_history = new List <List <int> >();
            pointHist       = new PointCollection();
            point3DHist     = new Point3DCollection();
            data_history    = new List <float[]>();

            bin        = new int[buffersize * 2];
            sampledata = new float[buffersize * 2];
            priori     = new double[buffersize * 2];

            channelLabel    = new int[1];
            channelLabel[0] = 1;
            velocity        = new int[1];
            velocity[0]     = 0;

            prev_displacement    = new int[1];
            prev_displacement[0] = 0;

            instant_displacement    = new int[1];
            instant_displacement[0] = 0;

            towards_displacement    = new int[1];
            towards_displacement[0] = 1;


            displacement    = new int[1];
            displacement[0] = 0;
            bars            = new Rectangle[1];
            bars[0]         = createBar(channelLabel[0], selectedChannels, velocity[0], 33);
            lines           = new Line[1];
            lines[0]        = createLine(channelLabel[0], selectedChannels);
            for (int i = 0; i < buffersize * 2; i++)
            {
                bin[i]        = i;
                sampledata[i] = 0;
                priori[i]     = 0;
            }

            _barcanvas.Background = new SolidColorBrush(Colors.Black);

            history.Add(new List <int> {
                0
            });
            inverse_history.Add(new List <int> {
                0
            });


            Log = new GestureTests.Logger("ActionVisualizer");
            JK  = new JackKnife();
            //JK.InitializeFromSingleUser(GestureTests.Config.DataPath, userDirectory.Text, false);
            //JK.InitializeFromFolder(GestureTests.Config.DataPath);
        }