How do I use collection classes to enumerate speech objects?

Last reviewed: 7/15/2015

HOW Article ID: H071502

The information in this article applies to:

  • GrammarKit 5
  • KinesicsKit 3
  • LexiconKit 5
  • ProfileKit 5
  • SpeechKit 8
  • VoiceMarkupKit 5
  • VoiceXMLKit 2

Summary

Use for and foreach syntax to enumerate recognizers, synthesizers, profiles, recognized phrases, and other collections.

More Information

The following new collection classes are available for easy enumeration:

  • AudioBeamSubFrameCollection
  • AudioBodyCorrelationCollection
  • ChantAlternateCollection
  • ChantAlternateWordCollection
  • ChantAudioCaptureDeviceCollection
  • ChantAudioInDeviceCollection
  • ChantAudioMixerCollection
  • ChantAudioMixerLineCollection
  • ChantAudioOutDeviceCollection
  • ChantAudioRenderDeviceCollection
  • ChantDictationSourceCollection
  • ChantDictationTopicCollection
  • ChantLexiconShortcutCollection
  • ChantLexiconWordPronunciationCollection
  • ChantPhrasePropertyCollection
  • ChantRuleCollection
  • ChantSpeakerCollection
  • ChantSpeakerPropertyCollection
  • ChantSREngineCollection
  • ChantTTSEngineCollection
  • ChantWordAlternateCollection
  • ChantWordCollection
  • JointOrientationCollection

The following example illustrates enumerating speech engines and accessing their properties.


private Chant.SpeechKit.NChantTTS NChantTTS1;
foreach (NChantTTSEngine chantTTSEngine in NChantTTS1.ChantTTSEngines)
{
    // Access engine properties
    string engine = chantTTSEngine.Engine;
}
    

int numberOfEngines = pChantTTS->GetChantTTSEngines()->GetCount();
for (i = 0; i < numberOfEngines; i++)
{
    CChantTTSEngine* pChantTTSEngine = pChantTTS->GetChantTTSEngines()->GetChantTTSEngines(i);
    // Access engine properties
    wchar_t* engine = pChantTTSEngine->GetEngine();
}

int numberOfEngines = pChantTTS->GetChantTTSEngines()->GetCount();
for (i = 0; i < numberOfEngines; i++)
{
    CChantTTSEngine* pChantTTSEngine = pChantTTS->GetChantTTSEngines()->ChantTTSEngines(i);
    // Access engine properties
    String engine = pChantTTSEngine->GetDisplay();
}

var
chantTTSEngine: TChantTTSEngine;
engine: string;
begin
    for chantTTSEngine in ChantTTS1.ChantTTSEngines do
    begin
        // Access engine properties
        engine := chantTTSEngine.Engine; 
    end;
end;

for (JChantTTSEngine engine : JChantTTS1.getChantTTSEngines())
{
    // Access engine properties
    String engine = engine.getEngine(); 
}

Dim chantTTSEngine As NChantTTSEngine
Dim engine As String
    For Each chantTTSEngine In NChantTTS1.ChantTTSEngines
        ' Access engine properties
        engine = chantTTSEngine.Engine 
    Next