Exemplo n.º 1
0
        //來源方向
        static void audioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            KinectSensor sensor = KinectSensor.KinectSensors[0];
            sensor.Start();

            string maxmins = " ,最大Source Angle :" + KinectAudioSource.MaxSoundSourceAngle
                                        + " , 最小Sound Angle :" + KinectAudioSource.MinSoundSourceAngle;

            string maxmin = " ,最大Beam Angle :" + KinectAudioSource.MaxBeamAngle
                           + " , 最小Beam Angle :" + KinectAudioSource.MinBeamAngle;

            //+ maxmin;

            if (e.ConfidenceLevel >= 0.9)
            {

                string output = "來源角度 :" + e.Angle.ToString("#.##")
                   + " , Source Confidence: " + e.ConfidenceLevel.ToString("#.##");
                Console.WriteLine(output);
                    if ((int)e.Angle > 0)
                    {
                        if ((sensor.ElevationAngle <= 22) )
                        { sensor.ElevationAngle += 5; Console.Write("硬了硬了~~~~~~~~\n"); }
                    }
                    if ((int)e.Angle < 0)
                    {
                        if ( (sensor.ElevationAngle >= -22))
                        { sensor.ElevationAngle -= 5; Console.Write("軟掉啦~~~~~~~~\n"); }
                    }

                Console.WriteLine(output);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 音源方向が通知される
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            if (e.ConfidenceLevel > 0.5)
            {
                const int Range = 5; // 誤差範囲
                soundSourceAngle = (int)e.Angle;

                for (int i = 1; i < playerAngles.Length; i++)
                {
                    // 無効なプレイヤー
                    if (playerAngles[i] == -1)
                    {
                        continue;
                    }

                    // 音源と頭の角度が一定範囲内にあれば、その人の音とみなす
                    if (((soundSourceAngle - Range) <= playerAngles[i]) &&
                        (playerAngles[i] <= (soundSourceAngle + Range)))
                    {
                        enablePlayer[i] = true;
                    }

                    // ユーザーの位置を表示する
                    labelSoundSource.Content = string.Format("音源方向:{0}, プレイヤー方向:{1}",
                                                             soundSourceAngle.ToString(), playerAngles[i]);
                }
            }
        }
Exemplo n.º 3
0
 private void SoundSourceAngleChanged(Object sender, SoundSourceAngleChangedEventArgs e)
 {
     foreach (SoundSourceAngleListener listener in new List <SoundSourceAngleListener>(soundSourceAngleListeners))
     {
         listener.onSoundSourceAngleChanged((float)e.Angle, (float)e.ConfidenceLevel);
     }
 }
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            // Set width of mark based on confidence
            this.Confidence = (int)Math.Round(e.ConfidenceLevel * 100);

            // Move indicator
            this.SourceAngle = e.Angle;
        }
 /// <summary>
 /// Handle SoundSourceAngleChanged event
 /// </summary>
 private void audio_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     if (e.ConfidenceLevel > 0.9)
     {
         _sourceAngle = _angleMultiplier * e.Angle;
         NotifyPropertyChanged(PROPERTY_SOURCE_ANGLE);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Handles event triggered when sound source angle changes.
 /// </summary>
 /// <param name="sender">object sending the event.</param>
 /// <param name="e">event arguments.</param>
 private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     //Rotate gradient to match angle
     if (this.sourceRotation.Angle != -e.Angle && e.ConfidenceLevel > 0.9)
     {
         sourceRotation.Angle = -e.Angle;
         beamRotation.Angle   = sourceRotation.Angle;
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Handles the SoundSourceAngleChanged event of the source control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SoundSourceAngleChangedEventArgs" /> instance containing the event data.</param>
 void source_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     ViewModel.SoundSourceAngle = e.Angle.ToString();
     if (e.Angle <= 20 && e.Angle >= -20)
         inAngle = true;
     else
         inAngle = false;
     
 }
Exemplo n.º 8
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     //音が発生した角度
     this.Label_SoundSourceAngleChanged_Angle.Content = "Angle : " + e.Angle;
     //推定された角度の信頼度
     this.Label_SoundSourceAngleChanged_Confidence.Content = "Confidence : " + e.ConfidenceLevel;
     //音が発生した角度をスライダに対応付ける
     this.Slider_SoundSourceAngleChanged_Angle.Value = e.Angle;
 }
Exemplo n.º 9
0
        private void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            KinectBase.AudioPositionEventArgs audioE = new KinectBase.AudioPositionEventArgs();
            audioE.kinectID   = this.kinectID;
            audioE.audioAngle = e.Angle;
            audioE.confidence = e.ConfidenceLevel;

            OnAudioPositionChanged(audioE);
        }
Exemplo n.º 10
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     //音が発生した角度
     this.Label_SoundSourceAngleChanged_Angle.Content = "Angle : " + e.Angle;
     //推定された角度の信頼度
     this.Label_SoundSourceAngleChanged_Confidence.Content = "Confidence : " + e.ConfidenceLevel;
     //音が発生した角度をスライダに対応付ける
     this.Slider_SoundSourceAngleChanged_Angle.Value = e.Angle;
 }
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            // Set width of mark based on confidence
            this.SoundSourceWidth = Math.Max(((1 - e.ConfidenceLevel) / 2), 0.02);

            // Move indicator
            this.SoundSourceAngleInDegrees = e.Angle;

            // Update text
            this.SoundSourceDisplayText = " Sound source angle = " + this.SoundSourceAngleInDegrees.ToString("0.00") + " deg  Confidence level=" + e.ConfidenceLevel.ToString("0.00");
        }
Exemplo n.º 12
0
 // SoundSourceAngleChanged イベントのハンドラ
 // (確度が一定以上の場合だけ記録)
 private void SoundSourceChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     if (e.ConfidenceLevel > 0.5)
     {
         soundDir = e.Angle;
     }
     else
     {
         soundDir = double.NaN;
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Handler for event triggered when sound source angle changes in Kinect audio stream.
        /// </summary>
        /// <param name="sender">
        /// Object sending the event.
        /// </param>
        /// <param name="e">
        /// Event arguments.
        /// </param>
        private void SoundSourceChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            DateTime now = DateTime.Now;

            recentSourceAngles.Enqueue(new RecentAngle(now, e));

            // Remove angles past our time range of interest
            while (recentSourceAngles.Peek().Key < now.AddMilliseconds(-AngleRetentionPeriod))
            {
                recentSourceAngles.Dequeue();
            }
        }
Exemplo n.º 14
0
        static void audioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            string maxmin = " ,最大Source Angle :" + KinectAudioSource.MaxSoundSourceAngle
                                        + " , 最小Sound Angle :" + KinectAudioSource.MinSoundSourceAngle;
            string output = "偵測到Source Angle :" + e.Angle.ToString()
                        + " , Source Confidence: " + e.ConfidenceLevel.ToString()
                        + maxmin;

            Console.WriteLine(output);

            //主動取得
            //string output2 = "SoundSourceAngle :" + audiosource.SoundSourceAngle +
            //                                    " , SoundSourceAngleConfidence: " + audiosource.SoundSourceAngleConfidence;
            //Console.WriteLine(output2);
        }
Exemplo n.º 15
0
        static void audioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            string maxmin = " ,最大Source Angle :" + KinectAudioSource.MaxSoundSourceAngle
                                        + " , 最小Sound Angle :" + KinectAudioSource.MinSoundSourceAngle;
            string output = "偵測到Source Angle :" + e.Angle.ToString()
                        + " , Source Confidence: " + e.ConfidenceLevel.ToString()
                        + maxmin;

            Console.WriteLine(output);

            //主動取得
            //string output2 = "SoundSourceAngle :" + audiosource.SoundSourceAngle +
            //                                    " , SoundSourceAngleConfidence: " + audiosource.SoundSourceAngleConfidence;
            //Console.WriteLine(output2);
        }
Exemplo n.º 16
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     if (server.serverMasterOptions.kinectOptions[kinectID].sendAudioAngle && server.isRunning)
     {
         for (int i = 0; i < server.serverMasterOptions.analogServers.Count; i++)
         {
             if (server.serverMasterOptions.analogServers[i].serverName == server.serverMasterOptions.kinectOptions[kinectID].audioAngleServerName)
             {
                 lock (server.analogServers[i])
                 {
                     server.analogServers[i].AnalogChannels[server.serverMasterOptions.kinectOptions[kinectID].audioAngleChannel].Value = e.Angle;
                     server.analogServers[i].Report();
                 }
             }
         }
     }
 }
Exemplo n.º 17
0
        public void KinectAudioSourceSoundSourceAngleChanged(Object Sender, SoundSourceAngleChangedEventArgs e)
        {
            try
            {
                string message = new string('0', 0);

                message += getIdSensor(sensor) + "||";
                message += e.Angle + "||" + e.ConfidenceLevel;

                KServerPaquet sp = new KServerMessagePaquet(206, message.Replace(',', '.'));
                sp.send(ns);
            }
            catch (Exception exc)
            {
                System.Console.WriteLine("event AudioSourceBeamAngleChanged disconnected : " + exc.Message);
                sensor.AudioSource.SoundSourceAngleChanged -= KinectAudioSourceSoundSourceAngleChanged;
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Handles event triggered when sound source angle changes.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            // Maximum possible confidence corresponds to this gradient width
            const double MinGradientWidth = 0.04;

            // Set width of mark based on confidence.
            // A confidence of 0 would give us a gradient that fills whole area diffusely.
            // A confidence of 1 would give us the narrowest allowed gradient width.
            double halfWidth = Math.Max((1 - e.ConfidenceLevel), MinGradientWidth) / 2;

            // Update the gradient representing sound source position to reflect confidence
            this.sourceGsPre.Offset  = Math.Max(this.sourceGsMain.Offset - halfWidth, 0);
            this.sourceGsPost.Offset = Math.Min(this.sourceGsMain.Offset + halfWidth, 1);

            // Rotate gradient to match angle
            sourceRotation.Angle = -e.Angle;

            sourceAngleText.Text      = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceAngle, e.Angle.ToString("0", CultureInfo.CurrentCulture));
            sourceConfidenceText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceConfidence, e.ConfidenceLevel.ToString("0.00", CultureInfo.CurrentCulture));
        }
Exemplo n.º 19
0
        void hikaku(SoundSourceAngleChangedEventArgs f)
        {
            double hk;
            //ターゲットの決定
            Random rand     = new Random();
            double tgnumber = rand.Next(-50, 50);

            this.Label_Targetangle.Content = "Target : " + tgnumber;

            if (tgnumber >= f.Angle)
            {
                hk = tgnumber - f.Angle;
            }
            else
            {
                hk = f.Angle - tgnumber;
            }
            if (hk > 20)
            {
                this.Label_compare.Content = "distant";
            }
            else
            if (hk > 10)
            {
                this.Label_compare.Content = "near";
            }
            else if (hk > 5)
            {
                this.Label_compare.Content = "good";
            }
            else if (hk > 1)
            {
                this.Label_compare.Content = "Great";
            }
            else
            {
                this.Label_compare.Content = "EXELLENT";
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 音源方向が通知される
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void AudioSource_SoundSourceAngleChanged( object sender, SoundSourceAngleChangedEventArgs e )
        {
            if ( e.ConfidenceLevel > 0.5 ) {
            const int Range = 5;  // 誤差範囲
            soundSourceAngle = (int)e.Angle;

            for ( int i = 1; i < playerAngles.Length; i++ ) {
              // 無効なプレイヤー
              if ( playerAngles[i] == -1 ) {
            continue;
              }

              // 音源と頭の角度が一定範囲内にあれば、その人の音とみなす
              if ( ((soundSourceAngle - Range) <= playerAngles[i]) &&
                (playerAngles[i] <= (soundSourceAngle + Range)) ) {
            enablePlayer[i] = true;
              }

              // ユーザーの位置を表示する
              labelSoundSource.Content = string.Format( "音源方向:{0}, プレイヤー方向:{1}",
            soundSourceAngle.ToString(), playerAngles[i] );
            }
              }
        }
Exemplo n.º 21
0
        void hikaku(SoundSourceAngleChangedEventArgs f)
        {
            double hk;
            //ターゲットの決定
            Random rand = new Random();
            double tgnumber = rand.Next(-50, 50);
            this.Label_Targetangle.Content = "Target : " + tgnumber;

            if (tgnumber >= f.Angle) {  hk = tgnumber - f.Angle; }
            else { hk = f.Angle - tgnumber; }
            if (hk > 20) { this.Label_compare.Content = "distant"; }
            else
                if( hk > 10){this.Label_compare.Content = "near"  ; }
                else if (hk > 5) { this.Label_compare.Content = "good"; }
                else if (hk > 1) { this.Label_compare.Content = "Great"; }
                else { this.Label_compare.Content = "EXELLENT"; }
        }
 // 声源角度
 //     Gets the angle (in degrees) from kinect sensor towards the current sound
 //     source. When facing the Kinect: 0: center positive angles: right negative
 //     angles: left Range is -50 to +50 degrees.
 private void OnAudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     _currentSoundSourceAngle = e.Angle;
     Console.WriteLine(string.Format("{0}, {1}, {2}", "SoundSourceAngle", e.Angle, e.ConfidenceLevel));
 }
Exemplo n.º 23
0
        /// <summary>
        /// Handler for event triggered when sound source angle changes in Kinect audio stream.
        /// </summary>
        /// <param name="sender">
        /// Object sending the event.
        /// </param>
        /// <param name="e">
        /// Event arguments.
        /// </param>
        private void SoundSourceChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            DateTime now = DateTime.Now;
            recentSourceAngles.Enqueue(new RecentAngle(now, e));

            // Remove angles past our time range of interest
            while (recentSourceAngles.Peek().Key < now.AddMilliseconds(-AngleRetentionPeriod))
            {
                recentSourceAngles.Dequeue();
            }
        }
Exemplo n.º 24
0
 void soundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     this.soundSourceAngle.Text = e.Angle.ToString();
     this.confidenceLevel.Text  = e.ConfidenceLevel.ToString();
 }
 private void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     AjustarPonteiroPorAngulo(e.Angle, ponteiroSoundSourceAngle);
 }
Exemplo n.º 26
0
 // Event Handler for AudioSourceSoundSourceAngleChanged events
 private void SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     sourceRotation = -e.Angle;
 }
        /// <summary>
        /// Handles event triggered when sound source angle changes.
        /// Assigns the appropriate max Sound intensity camera to the allframe handler.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("Entered AudioSource");

            // Maximum possible confidence corresponds to this gradient width
            const double MinGradientWidth = 0.04;
            int maxIntensityDevice = 0;
            // Find the Kinect sensor which has the highest intensity recording.
            for (int j = 0; j < deviceCount; j++)
            {
                if (audioKinect[j].energy[audioKinect[j].energyIndex] > audioKinect[maxIntensityDevice].energy[audioKinect[maxIntensityDevice].energyIndex])
                    maxIntensityDevice = j;
                //System.Diagnostics.Debug.WriteLine("***NEW MAX INTENSITY DEVICE " + j + "***");
            }

            // Check if it is above the minimum background noise intensity level.
            if (audioKinect[maxIntensityDevice].energy[audioKinect[maxIntensityDevice].energyIndex] > BackgroundNoiseIntensity)
            {
                System.Diagnostics.Debug.Print("Highest intensity on device ID#: " + audioKinect[maxIntensityDevice].sensor.UniqueKinectId);
                voiceDetectionArr[maxIntensityDevice]++;
                //this runs only once, at program start so the first camera is assigned.
                if (firstCheck == 0)
                {
                    //audioKinect[maxIntensityDevice].sensor.ColorFrameReady += this.ColorFrameReady;
                    audioKinect[maxIntensityDevice].sensor.AllFramesReady += this.AllFrameReadyHandler;
                    currentSensorNo = maxIntensityDevice;
                    //the first run is done, state flag is incremented to 1.
                    firstCheck = 1;
                }
                //this device has recorded highest intensity for this number of continuous frames : 3
                if (voiceDetectionArr[maxIntensityDevice] == 3)
                {
                    if (firstCheck == 1)
                    {
                        //audioKinect[maxIntensityDevice].sensor.ColorFrameReady -= this.ColorFrameReady;
                        audioKinect[maxIntensityDevice].sensor.AllFramesReady -= this.AllFrameReadyHandler;
                        firstCheck = 2;
                    }

                    //remove handlers for all other devices except this maxIntensityDevice.
                    removeAllHandlers(maxIntensityDevice);
                    //if (currentSensorNo != maxIntensityDevice)
                     //audioKinect[maxIntensityDevice].sensor.ColorFrameReady += this.ColorFrameReady;

                    audioKinect[maxIntensityDevice].sensor.AllFramesReady += this.AllFrameReadyHandler;
                    currentSensorNo = maxIntensityDevice;
                    //voiceDetectionArr[maxIntensityDevice] = 0;

                }
            }

            // Set width of mark based on confidence.
            // A confidence of 0 would give us a gradient that fills whole area diffusely.
            // A confidence of 1 would give us the narrowest allowed gradient width.
            double halfWidth = Math.Max((1 - e.ConfidenceLevel), MinGradientWidth) / 2;

            // Update the gradient representing sound source position to reflect confidence
            this.sourceGsPre.Offset = Math.Max(this.sourceGsMain.Offset - halfWidth, 0);
            this.sourceGsPost.Offset = Math.Min(this.sourceGsMain.Offset + halfWidth, 1);

            // Rotate gradient to match angle
            sourceRotation.Angle = -e.Angle;

            sourceAngleText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceAngle, e.Angle.ToString("0", CultureInfo.CurrentCulture));
            sourceConfidenceText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceConfidence, e.ConfidenceLevel.ToString("0.00", CultureInfo.CurrentCulture));
        }
        public void KinectAudioSourceSoundSourceAngleChanged(Object Sender, SoundSourceAngleChangedEventArgs e)
        {
            try
            {
                string message = new string('0', 0);

                message += getIdSensor(sensor) + "||";
                message += e.Angle + "||" + e.ConfidenceLevel;

                KServerPaquet sp = new KServerMessagePaquet(206, message.Replace(',', '.'));
                sp.send(ns);
            }
            catch (Exception exc)
            {
                System.Console.WriteLine("event AudioSourceBeamAngleChanged disconnected : " + exc.Message);
                sensor.AudioSource.SoundSourceAngleChanged -= KinectAudioSourceSoundSourceAngleChanged;
            }
        }
Exemplo n.º 29
0
 private void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     AjustarPonteiroPorAngulo(e.Angle, ponteiroSoundSourceAngle);
 }
Exemplo n.º 30
0
 /// <summary>
 /// 音源方向が変化した
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void AudioSource_SoundSourceAngleChanged( object sender, SoundSourceAngleChangedEventArgs e )
 {
     soundSource.Angle = -e.Angle;
 }
Exemplo n.º 31
0
 /// <summary>
 /// 音源の方向が変わったことが通知される
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void AudioSource_SoundSourceAngleChanged( object sender, SoundSourceAngleChangedEventArgs e )
 {
     soundDir = e.ConfidenceLevel > 0.5 ? e.Angle : double.NaN;
 }
Exemplo n.º 32
0
 /// <summary>
 /// 音源方向が変化した
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     soundSource.Angle = -e.Angle;
 }
Exemplo n.º 33
0
        private void MoveBox(SoundSourceAngleChangedEventArgs e)
        {
            Thickness margin = rectangle1.Margin;
            if (e.Angle > 0)
                margin.Left += 10;
            else
                margin.Left -=10;

            if (rectangle1.Margin.Left + rectangle1.Width > topPanel.ActualWidth)
                margin.Left += topPanel.ActualWidth - (rectangle1.Margin.Left + rectangle1.Width);
            else if (rectangle1.Margin.Left < -topPanel.ActualWidth)
                margin.Left = -topPanel.ActualWidth;

            rectangle1.Margin = margin;
        }
Exemplo n.º 34
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     this.theModel.updateSource(e.Angle);
 }
Exemplo n.º 35
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     //throw new NotImplementedException();
     soundSourceAngleTxt.Text = "Sound source angle:" + e.Angle;
 }
Exemplo n.º 36
0
 private void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     if (this.SoundSourceAngleChanged != null)
     {
         var soundS = new SoundSource
         {
              Angle = e.Angle,
              ConfidenceLevel = e.ConfidenceLevel
         };
         this.SoundSourceAngleChanged(soundS);
     }
 }
Exemplo n.º 37
0
        private void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            KinectBase.AudioPositionEventArgs audioE = new KinectBase.AudioPositionEventArgs();
            audioE.kinectID = this.kinectID;
            audioE.audioAngle = e.Angle;
            audioE.confidence = e.ConfidenceLevel;

            OnAudioPositionChanged(audioE);
        }
Exemplo n.º 38
0
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            // Set width of mark based on confidence
            this.Confidence = (int)Math.Round(e.ConfidenceLevel * 100);

            // Move indicator
            this.SourceAngle = e.Angle;
        }
Exemplo n.º 39
0
 void audioSource_SoundAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     string info = e.Angle + "," + e.ConfidenceLevel;
     if (logging)
         loggerQueue.addToQueue(audioAngleFileName, info);
 }
Exemplo n.º 40
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     Console.WriteLine("Angle: " + e.Angle);
     this.soundDirection = e.Angle;
 }
Exemplo n.º 41
0
 /// <summary>
 /// Handles event triggered when sound source angle changes.
 /// </summary>
 /// <param name="sender">object sending the event.</param>
 /// <param name="e">event arguments.</param>
 private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     //Rotate gradient to match angle
     if (this.sourceRotation.Angle != -e.Angle && e.ConfidenceLevel>0.9)
     {
         sourceRotation.Angle = -e.Angle;
         beamRotation.Angle = sourceRotation.Angle;
     }
 }
Exemplo n.º 42
0
 // Event Handler for AudioSourceSoundSourceAngleChanged events
 private void SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     sourceRotation = -e.Angle;
 }
Exemplo n.º 43
0
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            // Set width of mark based on confidence
            SoundSourceWidth = Math.Max(((1 - e.ConfidenceLevel)/2), 0.02);

            // Move indicator
            SoundSourceAngleInDegrees = e.Angle;

            // Update text
            SoundSourceDisplayText = " Sound source angle = " + SoundSourceAngleInDegrees.ToString("0.00") + " deg  Confidence level=" + e.ConfidenceLevel.ToString("0.00");
        }
Exemplo n.º 44
0
 void AudioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     soundSourceAngle = -e.Angle;
     soundConfidence = e.ConfidenceLevel;
     updateWindow();
 }
Exemplo n.º 45
0
        /// <summary>
        /// Handles event triggered when sound source angle changes.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        private void AudioSourceSoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
        {
            // Maximum possible confidence corresponds to this gradient width
            const double MinGradientWidth = 0.04;

            MoveBox(e);
            CheckChangeColor(e.Angle, e.ConfidenceLevel);

            // Set width of mark based on confidence.
            // A confidence of 0 would give us a gradient that fills whole area diffusely.
            // A confidence of 1 would give us the narrowest allowed gradient width.
            double halfWidth = Math.Max((1 - e.ConfidenceLevel), MinGradientWidth) / 2;

            // Update the gradient representing sound source position to reflect confidence
            this.sourceGsPre.Offset = Math.Max(this.sourceGsMain.Offset - halfWidth, 0);
            this.sourceGsPost.Offset = Math.Min(this.sourceGsMain.Offset + halfWidth, 1);

            // Rotate gradient to match angle
            sourceRotation.Angle = -e.Angle;

            sourceAngleText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceAngle, e.Angle.ToString("0", CultureInfo.CurrentCulture));
            sourceConfidenceText.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.SourceConfidence, e.ConfidenceLevel.ToString("0.00", CultureInfo.CurrentCulture));
        }
Exemplo n.º 46
0
 void audioSource_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     //label2.Content = audioSource.SoundSourceAngle;
 }
 /// <summary>
 /// Handle SoundSourceAngleChanged event
 /// </summary>
 private void audio_SoundSourceAngleChanged(object sender, SoundSourceAngleChangedEventArgs e)
 {
     if (e.ConfidenceLevel > 0.9)
       {
     _sourceAngle = _angleMultiplier * e.Angle;
     NotifyPropertyChanged(PROPERTY_SOURCE_ANGLE);
       }
 }