Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Speech Recognition Manager /
Chapter 1 - Speech Recognition Manager / Speech Recognition Manager Reference
Speech Recognition Manager Routines / Traversing Speech Objects


SRGetIndexedItem

You can use the SRGetIndexedItem function to get a subitem in a container object.

pascal OSErr SRGetIndexedItem (
SRSpeechObject container, 
SRSpeechObject *item, 
long index);
container
A speech object.
item
On exit, a reference to the subitem in the specified speech object that has the specified index.
index
An integer ranging from 0 to one less than the number of subitems in the specified speech object.
DESCRIPTION
The SRGetIndexedItem function returns, in the item parameter, a reference to the subitem at the index specified by the index parameter contained in the speech object specified by the container parameter. This function is useful for iterating through all subitems in a container object.

The value passed in the index parameter must be greater than or equal to 0 and less than the number of subitems in the specified container object. (You can call the SRCountItems function to determine the number of subitems contained in a speech object.) If the index you specify is not in this range, SRGetIndexedItem returns the result code kSRParamOutOfRange.

SPECIAL CONSIDERATIONS
SRGetIndexedItem increases the reference count of the specified speech object. You should call the SRReleaseObject function to release the object reference returned by SRGetIndexedItem when you're done using it. For example, you can get a reference to the third word in a phrase by executing this code:

myErr = SRGetIndexedItem(myPhrase, &myWord, 2);
Then, when you are finished using the word, you should execute this code:

myErr = SRReleaseObject(myWord);

Previous Book Contents Book Index Next

© Apple Computer, Inc.
22 JAN 1997