gpt4 book ai didi

c# - xbox 360 kinect光束角度与属性更改有关

转载 作者:行者123 更新时间:2023-12-02 23:47:38 24 4
gpt4 key购买 nike

试图在C#wpf中获取光束 Angular ,If PropertyChange上引发了异常。有没有人举这个项目的例子,如果需要,我可以提供更多信息。我正在尝试使麦克风更改属性,但会引发异常

        InitializeComponent();
//Beam Angle Code
this.DataContext = this.Rect;
this.Loaded += delegate { ListenForBeamChanges(); };
}

private KinectAudioSource CreateAudioSource()
{
var source = KinectSensor.KinectSensors[0].AudioSource;
source.NoiseSuppression = true;
source.AutomaticGainControlEnabled = true;
source.BeamAngleMode = BeamAngleMode.Adaptive;
return source;
}

private KinectAudioSource audioSource;
private void ListenForBeamChanges()
{
KinectSensor.KinectSensors[0].Start();
audioSource = CreateAudioSource();
audioSource.BeamAngleChanged += audioSource_BeamChanged;
audioSource.Start();
}

public double _beamAngle;
public double BeamAngle
{
get { return _beamAngle; }
set
{
_beamAngle = value;
OnPropertyChanged("BeamAngle");
}
}

void audioSource_BeamChanged(object sender, BeamAngleChangedEventArgs e)
{
BeamAngle = e.Angle * -1;
}

public event PropertyChangedEventHandler PropertyChanged;

public void OnPropertyChanged(string propName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}

}
}

最佳答案

http://kinectaudioposition.codeplex.com

http://channel9.msdn.com/coding4fun/kinect/Kinect-Audio-Positioning复制样本用法代码

/// <summary>
/// Event handler to care Window loaded
/// Construct KinectMicArray and draw contents
/// </summary>
private void Window_Loaded(object sender, RoutedEventArgs e)
{
kinectMic = new KinectMicArray();
kinectMic.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(kinectMic_PropertyChanged);
DrawContents();
}
/// <summary>
/// Event handler to care KinectMicArray property changed
/// Showing angles as number for debug
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void kinectMic_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
KinectMicArray ka = sender as KinectMicArray;
this.myLabel.Content = string.Format("Beam = {0:F}; Source = {1:F}; ", ka.BeamAngleProperty, ka.SourceAngleProperty);
}

关于c# - xbox 360 kinect光束角度与属性更改有关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29416204/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com