How do I create and destroy Chant objects in C++Builder and Delphi?

Last reviewed: 10/1/2011

HOW Article ID: H101102

The information in this article applies to:

  • GrammarKit 4
  • LexiconKit 4
  • ProfileKit 4
  • SpeechKit 7
  • VoiceMarkupKit 4

Summary

The new Chant C++Builder and Delphi class libraries in CDW 2011 provide you version independent Chant object classes that you can instantiate and destroy as needed. You are no longer tied to form initialization or termination.

More Information

Examples of instantiating and destroying your Chant class objects in C++Builder applications are illustrated in the following Knowledge Base articles:

Examples of instantiating and destroying your Chant class objects in Delphi applications are illustrated in the following Knowledge Base articles:

However, it is very important that you destroy any objects you obtain through Get methods as well as those you create.

int numberOfEngines = pChantTTS->GetResourceCount(CSREngine);
for (i = 0; i < numberOfEngines; i++)
{
    CChantTTSEngine* pChantTTSEngine = pChantTTS->GetChantTTSEngine(i);
    // Access speech synthesis engine properties
    String stringVal = pChantTTSEngine->GetEngine();
    // Destroy the engine object
    delete pChantTTSEngine;
}
var
aTChantTTSEngine: TChantTTSEngine;
numberOfEngines: Integer;
i: Integer;
stringVal: string;
begin
numberOfEngines := ChantTTS1.GetResourceCount(CSREngine);
for i := 0 to numberOfEngines - 1 do
    begin
        aTChantTTSEngine := ChantTTS1.GetChantTTSEngine(nIndex);
        // Access speech synthesis engine properties
        stringVal := aTChantTTSEngine.Engine; 
        // Destroy the engine object
        aTChantTTSEngine.Destroy();
    end;
end;