Last reviewed: 7/27/2024 9:10:37 AM

Microsoft Visual C++ Applications

Develop C++ applications that manage movement using your favorite version of Microsoft Visual C++.

The following sections describe the steps for integrating KinesicsKit with Microsoft Visual C++ applications.

KinesicsKit Header Files

KinesicsKit includes C++ header files comprised of the C++ classes that manage grammars and automatically load and unload the runtime DLL.

To access KinesicsKit C++ classes within a Visual C++ application, add project references to the following nuget packages:

  • Select the application project in the Solution Explorer.
  • Right-click the mouse and select the Manage Nuget Packages… menu item.
  • Enter Chant in the search bar.
  • Select the Chant.KinesicsKit.Windows package and press the Install button.
  • Chant KinesicsKit Windows package
  • Select the Chant.Shared.Windows package and press the Install button.
  • Chant Shared Windows package

To access the KinesicsKit C++ classes within your application, add a reference to the Chant shared and KinesicsKit header files in your C++ application header file:


#include "Chant.Shared.Windows.h"
#include "Chant.KinesicsKit.Windows.h"

Add a reference in your C++ application source file to the Chant shared and KinesicsKit code needed to dynamically load and unload the runtime DLL:


#include "Chant.Shared.Windows.cpp"
#include "Chant.KinesicsKit.Windows.cpp"

Object Instantiation

Declare a global variable for the KinesicsKit class, instantiate instance, set the credentials, and set the event handler message.

Add the following to your application header file:


    protected:
    CKinesicsKit*           _KinesicsKit;
    CChantKinectSensor*     _Sensor;
};

Add the following to your application source file:


// Instantiate KinesicsKit object
_KinesicsKit = new CKinesicsKit();
if (_KinesicsKit != NULL)
{
    // Set credentials
    _KinesicsKit->SetCredentials("Credentials");
    // Create sensor
    _Sensor = _KinesicsKit->CreateKinectSensor();
    if (_Sensor != NULL)
    {
            // Register Event Handlers
        _Sensor->SetMultiSourceFrameArrived(MultiSourceFrameArrived);
    }
}

KinesicsKit applications require the KinesicsKit library (CKinesicsKit.dll or CKinesicsKitX64.dll) and the applicable KinesicsKit API library in the same directory as the application .exe.

Speech API KinesicsKit Speech API class KinesicsKit Speech API library
Microsoft Kinect 2.0CKinectSensorCKinesicsKit.Kinect.dll or CKinesicsKitX64.Kinect.dll

Event Callbacks

Event callbacks are the mechanism in which the class object sends information back to the application such as compilation is complete or there was an error.


void CALLBACK MultiSourceFrameArrived(void* Sender, CMultiSourceFrameArrivedEventArgs* Args)
{
    CMultiSourceFrameReference* pMultiSourceFrameReference = Args->GetFrameReference();
    if (pMultiSourceFrameReference != NULL)
    {
        CMultiSourceFrame* pMultiSourceFrame = pMultiSourceFrameReference->AcquireFrame();
        if (pMultiSourceFrame != NULL)
        {
            ...
            delete pMultiSourceFrame;
        }
        delete pMultiSourceFrameReference;
    }
}

Development and Deployment Checklist

When developing and deploying C++ applications, ensure you have a valid license, bundle the correct Chant class library, and configure your installation properly on the target system. Review the following checklist before developing and deploying your applications:

  • Develop and deploy C++ applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy CKinesicsKit.dll to the target system and place in the same directory with your application.
  • Copy CKinesicsKit.Kinect.dll to the target system.
  • Develop and deploy C++ applications to any system with a valid license from Chant. See the section License for more information about licensing Chant software.
  • Copy CKinesicsKitX64.dll to the target system and place in the same directory with your application.
  • Copy CKinesicsKitX64.Kinect.dll to the target system.

Sample Projects

Microsoft Visual C++ sample projects that use nuget packages may be found in the following directory of the vssamples.zip download:

  • Chant\GKinesicsKit 7\CDLL.