Exemplo n.º 1
0
        private void ButtonSetFrequency(object sender, RoutedEventArgs e)
        {
            FrequencyController.Visibility = Visibility.Hidden;
            SourceSetter.Visibility        = Visibility.Visible;

            var noteName = ((KinectCircleButton)sender).Name;
            var corrFreq = NameToFreq(noteName);

            SoundCode.setFreq = corrFreq;

            switch (waveButtonName)
            {
            case "SineButton":
                SoundCode.GenerateSineWave();
                break;

            case "TrigButton":
                SoundCode.GenerateTrigWave();
                break;

            case "SquaButton":
                SoundCode.GenerateSquareWave();
                break;

            case "SawButton":
                SoundCode.GenerateSawToothWave();
                break;
            }
        }
Exemplo n.º 2
0
        private void KinectCircleButton_Mic(object sender, RoutedEventArgs e)
        {
            FileButton.Background = Brushes.White;
            MicButton.Background  = Brushes.White;
            SineButton.Background = Brushes.White;
            TrigButton.Background = Brushes.White;
            SquaButton.Background = Brushes.White;
            SawButton.Background  = Brushes.White;
            MicButton.Background  = Brushes.AliceBlue;

            SoundCode.InitialiseMic();
        }
Exemplo n.º 3
0
        private void Interact_Click(object sender, RoutedEventArgs e)
        {
            kinectRegion.Visibility = Visibility.Hidden;
            canvas.Visibility       = Visibility.Visible;

            Canvas.SetLeft(BlueCircle, (canvas.ActualWidth - BlueCircle.ActualWidth) / 2);
            Canvas.SetTop(BlueCircle, (canvas.ActualHeight - BlueCircle.ActualHeight) / 2);
            Canvas.SetLeft(RedCircle, (canvas.ActualWidth - RedCircle.ActualWidth) / 2);
            Canvas.SetTop(RedCircle, (canvas.ActualHeight - RedCircle.ActualHeight) / 2);
            if (SpotifyButton.Background != Brushes.AliceBlue)
            {
                Task state = SoundCode.ReproduceSound();
            }
            sensorChooser.Kinect.SkeletonFrameReady += new EventHandler <SkeletonFrameReadyEventArgs>(KinectSkeletonFrameReady);
            this.GetTrackData();
        }
Exemplo n.º 4
0
        private void browse_Click(object sender, RoutedEventArgs e)
        {
            string filename = @"C:\Users\marcl\Desktop\sample.mp3";

            // Create OpenFileDialog
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".mp3";

            // Display OpenFileDialog by calling ShowDialog method
            Nullable <bool> result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                // Open document
                filename             = dlg.FileName;
                FileNameTextBox.Text = filename;
            }

            SoundCode.InitialiseFileStream(filename);
        }
Exemplo n.º 5
0
        private void KinectCircleButton_Spotify(object sender, RoutedEventArgs e)
        {
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", this.token);

            SpotifyController.Visibility = Visibility.Visible;

            FileButton.Background    = Brushes.White;
            MicButton.Background     = Brushes.White;
            SineButton.Background    = Brushes.White;
            TrigButton.Background    = Brushes.White;
            SquaButton.Background    = Brushes.White;
            SawButton.Background     = Brushes.White;
            MicButton.Background     = Brushes.White;
            SpotifyButton.Background = Brushes.AliceBlue;

            this.SongFrame.Visibility        = Visibility.Visible;
            this.SongTitle.Visibility        = Visibility.Visible;
            this.Logo.Visibility             = Visibility.Visible;
            this.TitleIntestation.Visibility = Visibility.Visible;

            SoundCode.InitialiseMic();

            Task state = SoundCode.ReproduceSound();
        }
Exemplo n.º 6
0
        private void HandleJoints(JointCollection jointCollection)
        {
            Joint handLeft  = jointCollection[JointType.HandLeft];
            Joint handRight = jointCollection[JointType.HandRight];

            double leftX_Real  = (handLeft.Position.X + 0.7) / 1.4;
            double leftY_Real  = (handLeft.Position.Y + 0.7 - cameraHeight) / 1.4;
            double rightX_Real = (handRight.Position.X + 0.7) / 1.4;
            double rightY_Real = (handRight.Position.Y + 0.7 - cameraHeight) / 1.4;

            double leftX  = leftX_Real;
            double leftY  = 1.0 - leftY_Real;
            double rightX = rightX_Real;
            double rightY = 1.0 - rightY_Real;

            double normX_Left  = leftX * canvas.ActualWidth;
            double normY_Left  = leftY * canvas.ActualHeight;
            double normX_Right = rightX * canvas.ActualWidth;
            double normY_Right = rightY * canvas.ActualHeight;

            double leftRed = normX_Left - (RedCircle.ActualWidth / 2.0);
            double topRed  = normY_Left - (RedCircle.ActualHeight / 2.0);

            Canvas.SetLeft(RedCircle, leftRed);
            Canvas.SetTop(RedCircle, topRed);

            double leftBlue = normX_Right - (BlueCircle.ActualWidth / 2.0);
            double topBlue  = normY_Right - (BlueCircle.ActualHeight / 2.0);

            Canvas.SetLeft(BlueCircle, leftBlue);
            Canvas.SetTop(BlueCircle, topBlue);

            float newFreq = (float)(Math.Pow(2, -2 + 4 * rightY_Real));

            if (newFreq >= 0.0 && newFreq <= 4.0)
            {
                SoundCode.ChangePitch(newFreq);
            }

            float newVol = (float)leftY_Real;

            if (newVol >= 0.0 && newVol <= 1.0)
            {
                SoundCode.ChangeVolume(newVol);
            }


            if (leftY_Real > 0.5)
            {
                ArrowLeftUp.Fill   = Brushes.LightYellow;
                ArrowLeftDown.Fill = Brushes.Gold;
            }
            else if (leftY_Real < 0.5)
            {
                ArrowLeftDown.Fill = Brushes.LightYellow;
                ArrowLeftUp.Fill   = Brushes.Gold;
            }

            if (rightY_Real > 0.5)
            {
                ArrowRightUp.Fill   = Brushes.LightYellow;
                ArrowRightDown.Fill = Brushes.Gold;
            }
            else if (rightY_Real < 0.5)
            {
                ArrowRightDown.Fill = Brushes.LightYellow;
                ArrowRightUp.Fill   = Brushes.Gold;
            }
        }