Reputation: 340
So I'm writing an XNA app using the Kinect SDK and when my game changes from the game screen to another screen, I stop the Kinect by using
sensor.Stop();
sensor.Dispose();
And while it does work it has considerable lag and makes my game look unresponsive for at least 10 seconds. Then after that screen I go back to a game screen again but with different settings. So I use
//set all my event handlers
sensor.blahStream += myFunction;
sensor.Start();
Is this the best way to restart a Kinect?
Upvotes: 1
Views: 524
Reputation: 340
Just fiddled around some more, putting the stopping on a separate thread seems to work.
stopGameThread = new Thread(new ParameterizedThreadStart(stopGame));
stopGameThread.Start();
that calls this method:
void stopGame(object sender)
{
gScreen.sensor.Stop();
gScreen.sensor.Dispose();
running = false;
}
gScreen
is the game screen contained in this game screen wrapper.
If anyone has any better answers feel free to post them.
Upvotes: 1