Developing Delphi Prism .NET applications that speak and listen
Last reviewed: 11/29/2008
HOW Article ID: H110808
The information in this article applies to:
- SpeechKit 6
If you love the features of .NET class libraries and love Delphi, then Delphi Prism is for you.
In SpeechKit 6, new Delphi Prism .NET samples have been added to illustrate developing Delphi Prism applications that speak and listen.
The Chant SpeechKit 6 Win32 Developer Edition includes v1.1, v2, and v3 compiled SpeechKit class libraries. The Chant SpeechKit 6 WinCE Developer Edition includes cf2 compiled SpeechKit class libraries.
Within a Delphi Prism project, add the Chant.SpeechKit class library to your project with the following steps:
- highlight the References folder;
- press the right mouse button and select the Add Reference menu item;
- browse to the applicable version of the component libraries Chant.SpeechKit.DLL and Chant.Shared.DLL found in C:\Program Files\Chant\SpeechKit 6\Win32 Developer\NETv1.1\bin, C:\Program Files\Chant\SpeechKit 6\Win32 Developer\NETv2\bin or C:\Program Files\Chant\SpeechKit 6\Win32 Developer\NETv3\bin; and
- click OK to add the reference to your project.
Add Chant.SpeechKit and Chant.Shared to the Uses statement in your application to reference the SpeechKit classes and members within your code.
You declare the NChantSR and NChantTTS objects as follows:
// Declare global type variables for your class objects as part of your Form or Window declaration NChantSR1: NChantSR; NChantTTS1: NChantTTS; // Declare public procedures for your event handlers public method NChantSR1_HasEvent(sender: System.Object; e: HasEventArgs); method NChantTTS1_HasEvent(sender: System.Object; e: HasEventArgs);
You instantiate your class objects and add and event handers for the objects as follows:
// In your Form or Window constructor, instantiate your class objects NChantSR1 := new NChantSR(self); NChantTTS1 := new NChantTTS(self); // Add reference to your event handlers NChantSR1.HasEvent += new NChantSR.HasEventHandler(NChantSR1_HasEvent); NChantTTS1.HasEvent += new NChantTTS.HasEventHandler(NChantTTS1_HasEvent);
Delphi Prism sample projects are installed at [My] Documents\Chant SpeechKit 6\NETv2\VS2008\Delphi and [My] Documents\Chant SpeechKit 6\NETv3\VS2008\Delphi.