예제 #1
0
        public void setUpRecognized()
        {
            SkeletonUtils.modifyUI(
                new ThreadStart(() =>
            {
                try
                {
                    voiceControl.Fill = new SolidColorBrush(Colors.Green);
                }
                catch (Exception) { }
            }));

            if (skeletonClient != null)
            {
                skeletonClient.unsubscribeAll();
                skeletonClient.subscribe(new SkeletonListener(skeletonCanvas));
                recordingStream = new CurrentRecording();
                skeletonClient.subscribe(recordingStream);
            }

            foreach (BucketPosition pos in Enum.GetValues(typeof(BucketPosition)))
            {
                if (getController(pos) != null)
                {
                    SkeletonUtils.modifyUI(
                        new ThreadStart(() =>
                    {
                        try
                        {
                            progressBars[(int)pos].Value = getController(pos).getVolume();
                        }
                        catch (Exception) { }
                    }));

                    SkeletonUtils.modifyUI(
                        new ThreadStart(() =>
                    {
                        try
                        {
                            boxes[(int)pos].Fill = new SolidColorBrush((getController(pos).getVolume() > 100) ? Colors.Green : Colors.White);
                        }
                        catch (Exception) { }
                    }));
                }
            }
            playing = false;
        }
예제 #2
0
        private void setupServer(string serverIP)
        {
            if (voiceClient == null)
            {
                setupVoiceClient(serverIP);
                voiceClient.subscribe(new VoiceListener(this));
            }
            else
            {
                TcpClient oldClient = voiceClient;
                setupVoiceClient(serverIP);
                foreach (ClientListener listener in oldClient.getListerners())
                {
                    voiceClient.subscribe(listener);
                }
                oldClient.shutdown();
            }
            if (skeletonClient == null)
            {
                setupSkeletonClient(serverIP);
                skeletonClient.subscribe(new SkeletonListener(skeletonCanvas));
                recordingStream = new CurrentRecording();
                skeletonClient.subscribe(recordingStream);

                rightArmAnalyzer = new ArmAnalyzerListener(bucketMedia, bucketPrecision, true, this);
                leftArmAnalyzer  = new ArmAnalyzerListener(bucketMedia, bucketPrecision, false, this);
            }
            else
            {
                TcpClient oldClient = skeletonClient;
                setupSkeletonClient(serverIP);
                foreach (ClientListener listener in oldClient.getListerners())
                {
                    skeletonClient.subscribe(listener);
                }
                oldClient.shutdown();
            }
            // Not using camera because it is too slow over the network
            //cameraClient = new TcpClient(serverIP, 8082, new CameraListener(MainImage));
        }