No Kinect lights on after KinectSensor->Open() despite S_OK status in C++ Windows Store app (Direct3D + XAML) RRS feed

  • Question

  • Hi there,

    I'm creating a C++ Windows Store app from the Direct3D + XAML template in Visual Studio 2013.

    I've enabled microphone & web camera capabilities and am successfully linking/including/compiling my project, which includes the following code, lifted pretty much directly from the DepthBasics-D2D example.

    	HRESULT hr;
    	hr = GetDefaultKinectSensor(&m_pKinectSensor);
    	if (FAILED(hr))
    		return hr;
    	if (m_pKinectSensor)
    		hr = m_pKinectSensor->Open();

    This last line returns S_OK, but future AcquireLatestFrame() calls only return E_PENDING.

    In the DepthBasics-D2D example, if I put a break point right after the m_pKinectSensor->Open() call, I can see the light on my Kinect sensor turn on right after the Open() call.

    In the app I've created off of the Direct3D+XAML Windows Store template, the Kinect's light does not turn on after the successful Open() call.

    Any insight would be welcome! Happy to provide any other information. I've written command line utilities that are pulling in the Kinect libraries successfully so I'm curious to know what I'm missing!



    • Edited by NajeebT Tuesday, August 26, 2014 8:47 PM
    Tuesday, August 26, 2014 8:42 PM

All replies

  • The lights on the sensor only come on when you acquire data. Without seeing how you wrote the code, it is difficult to know the issue.

    What are your system specs, do you have a dxdiag? Do you have any issues running other samples?

    How are you adding the reference to the winmd? Did you follow the instructions from the docs:

    You must add the reference from the Windows > Extensions dialog, and not using the browse option.

    Carmine Sirignano - MSFT

    Wednesday, August 27, 2014 4:49 PM
  • First off, thanks -- I was not adding the reference correctly via the Extensions dialogue. If there's a way to update the linked reference page as well, it would be great, I know that it's obvious to Visual Studio veterans but for the most part I've developed on Linux and Mac.

    Samples all run great, and I've written a lot of my own code within them – it's the creation of this new project that's giving me trouble.

    Despite the addition of the extension and adding the namespace, I'm still getting an E_PENDING, but I'm going to spend a little time debugging.

    The structure of the code is as follows:

    Built from the Visual Studio DirectX + XAML template (Windows only, no Windows Phone). There is a DirectXPage.xaml class and a KinectHandler class. Most of the Kinect code lives in the KinectHandler class.

    On a button click, DirectXPage.xaml.cpp calls into a m_kinectHandler->InitializeDefaultSensor() which successfully grabs the default IKinectSensor and Open()s it. Future AcquireLatestFrame() calls return E_PENDING. (Lights do not turn on on the Kinect.)

    The KinectHandler class includes the <Kinect.h> file.

    The DirectXPage.xaml class has the

    using namespace WindowsPreview::Kinect;

    Once I've dug into it a little more I'll send the dxdiag as well.



    Wednesday, August 27, 2014 5:30 PM
  • On your Initialize function, what type of reader object are you creating, MultiSourceFrameReader or just a DepthFrameReader etc? I am assuming you are using a polling mechanism, so in the update, when you acquire the frame, I assume you are checking for nullptr first?

    You can follow the same pattern that you see in the Xaml app for acquiring the frame. If you use the event model it gets more involved.


    Carmine Sirignano - MSFT

    Thursday, August 28, 2014 6:43 PM
  • There are a few different pathways for accessing this functionality, and through the one XAML & C++ Windows Store example that was (just?) added to the latest SDK release I've reimplemented the program using the WindowsPreview::Kinect namespace, which was the fundamental problem. I was using the more C-like paradigms of including Kinect.h and calling the methods used in 90% of the C++ examples. Just the cost of coding for Windows Store for the first time, I guess.

    I was using a MultiSourceFrameReader, but I've switched to independent readers for the frames that I care about...I didn't want to deal with registering the TypedEventHandlers for the MultiSourceFrameReader, honestly I haven't even looked into it yet.

    What does that wind up looking like, though? I'll definitely be interested in having synced video and depth data down the line.



    Friday, August 29, 2014 12:14 AM
  • You cannot use the COM(Kinect20.lib/.dll/.h) files in Windows Store applications. While the app will compile and probably run it will not pass certification.

    Carmine Sirignano - MSFT

    Friday, August 29, 2014 4:45 PM