Last reviewed: 3/23/2024 9:09:07 AM
Delphi VCL and FireMonkey Applications
Develop Object Pascal applications that manage movement using your favorite version of Delphi.
The following sections describe the steps for integrating KinesicsKit with Delphi VCL and FireMonkey applications.
KinesicsKit Unit
KinesicsKit includes an Object Pascal source file Chant.KinesicsKit.pas comprised of the Object Pascal classes that manage grammars. It also includes an Object Pascal source file Chant.Shared.pas comprised of common Object Pascal classes that all Chant libraries use.
To access the KinesicsKit Object Pascal classes within your application, first add a project reference to the KinesicsKit Object Pascal source files:
- Within your Delphi project, select Project Options.
- Select the Delphi compiler options.
- Add Search path reference to the KinesicsKit unit source file directory: C:\Program Files\Chant\KinesicsKit 8\Delphi\source.
- Add unit output path reference to the local directory with a period '.' character.
To access the KinesicsKit Object Pascal classes within your application, add a reference to the Chant.Shared and Chant.KinesicsKit units in your uses clause.
unit Unit1;
interface
uses
..., Chant.Shared, Chant.KinesicsKit;
Add an event handler declaration and Object instance variable to the application declarations.
type
TForm1 = class(TForm)
...
procedure MultiSourceFrameArrived(Sender: TObject; Args: TMultiSourceFrameArrivedEventArgs);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
_KinesicsKit: TKinesicsKit = nil;
_Sensor: TChantKinectSensor = nil;
Object Instantiation
Instantiate an instance, set the credentials, and set the event handler message.
// Instantiate KinesicsKit and Sensor object
_KinesicsKit := TKinesicsKit.Create();
if (_KinesicsKit <> nil) then
begin
// Set credentials
_KinesicsKit.SetCredentials('Credentials');
// Create recognizer
_Sensor := _KinesicsKit.CreateKinectSensor();
if (_Sensor <> nil) then
begin
// Register Event Handlers
_Sensor.MultiSourceFrameArrived := MultiSourceFrameArrived;
end;
end;
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.0 | TKinectSensor | CKinesicsKit.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.
procedure TForm1.MultiSourceFrameArrived(Sender: TObject; Args: TMultiSourceFrameArrivedEventArgs);
var
multiSourceFrameReference: TMultiSourceFrameReference;
multiSourceFrame: TMultiSourceFrame;
bodyFrameReference: TBodyFrameReference;
colorFrameReference: TColorFrameReference;
depthFrameReference: TDepthFrameReference;
begin
multiSourceFrameReference := Args.FrameReference;
if (multiSourceFrameReference <> nil) then
begin
multiSourceFrame := multiSourceFrameReference.AcquireFrame;
if (multiSourceFrame <> nil) then
begin
...
multiSourceFrame.Destroy;
end;
multiSourceFrameReference.Destroy;
end;
end;
Development and Deployment Checklist
When developing and deploying Delphi VCL and FireMonkey 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 Delphi VCL and FireMonkey 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 Delphi VCL and FireMonkey 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
Delphi VCL and FireMonkey sample projects are installed at the following location:
- Documents\Chant\KinesicsKit 8\Delphi.